Metaobject Protocol

--Originally published at diegotc2016

According to Wikipedia the metaobject protocol provides the vocabulary to access and manipulate the structure and behavior of objects.

The main functions of the MOP are:

  • Creating and deleting new clases
  • Creating new methods and properties
  • Changing the structure of clases so that clases can inhert from other classes
  • Make or modify code for defining methods of a class

The MOP allows a system to modify the internal structure of objects.

I investigated more about the MOP and there’s a book about it which is called the Art of the Metaobject Protocol.

Metaobject Protocol

I got these information out of:

https://en.wikipedia.org/wiki/Metaobject

 


Metaobject Protocol

#WSQ09- The Movies (Still not finished)

--Originally published at diegotc2016

This WSQ was really hard I have to search for a lot of documentation, I look to this assignment in python and I searched for other classmates assignment.

Here is a picture of my entire code so that you can understand it better: ****file is WSQ 09***

#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)

Here’s the picture from the other file: ****this file is named movies****

#WSQ09- The Movies (Still not finished)#WSQ09- The Movies (Still not finished)

Anyway here are the both files in github:

https://github.com/diegoalatorre/TC2016meromero/blob/master/WSQ09%2Cjava

https://github.com/diegoalatorre/TC2016meromero/blob/master/Movies.java

Note: This WSQ was “based” in one of my classmates WSQ

I got this out of:

https://docs.oracle.com/javase/tutorial/essential/io/

I wont go to the movies again – WSQ09

 


#WSQ09- The Movies (Still not finished)

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

--Originally published at diegotc2016

First of all I think changing to OOP was difficult because  I’ve learned this way of programming in a new language which is Java and this programming language has more difficult syntax than python has, most of beginners of programming use a simple language like python.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

The next thing I think has made OOP difficult is the proccess in order to code. I was used to code and just code without any paper proccess before coding. For programming in an object oriented way first you have to design the clases and these goes without any coding process, you are even told that you have to do the design process in paper and not just in an electronic tool.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

And the last thing that makes OOP a little bit difficult is the new concepts. This new concepts include class, method, encapsulation, inheritance, polymorphism. The new concepts may be difficult to understand if you have only worked with variables, lists, conditionals and just in a beginner way of programming.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?


Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

What do you feel are the benefits to object-oriented programming?

--Originally published at diegotc2016

According to c4learn.com these are the advantages of OOP:

  • OOP provides a clear modular structure for programs.
  • It is good for defining abstract data types.
  • Implementation details are hidden from other modules and other modules has a clearly defined interface.
  • It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
  • objects, methods, instance, message passing, inheritance are some important properties provided by these particular languages
  • encapsulation, polymorphism, abstraction are also counts in these fundamentals of programming language.
  • It implements real life scenario.
  • In OOP, programmer not only defines data types but also deals with operations applied for data structures.
  • Large programs are very difficult to write. Object Oriented Programs force designers to go through an extensive planning phase, which makes for better designs with less flaws

What do you feel are the benefits to object-oriented programming?

I got this out of:

Advantages And Features Of Object Oriented Programming

https://www.cs.drexel.edu/~introcs/Fa15/notes/06.1_OOP/Advantages.html?CurrentSlide=3


What do you feel are the benefits to object-oriented programming?

What do you feel are the benefits to object-oriented programming?

--Originally published at diegotc2016

According to c4learn.com these are the advantages of OOP:

  • OOP provides a clear modular structure for programs.
  • It is good for defining abstract data types.
  • Implementation details are hidden from other modules and other modules has a clearly defined interface.
  • It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
  • objects, methods, instance, message passing, inheritance are some important properties provided by these particular languages
  • encapsulation, polymorphism, abstraction are also counts in these fundamentals of programming language.
  • It implements real life scenario.
  • In OOP, programmer not only defines data types but also deals with operations applied for data structures.
  • Large programs are very difficult to write. Object Oriented Programs force designers to go through an extensive planning phase, which makes for better designs with less flaws

What do you feel are the benefits to object-oriented programming?

I got this out of:

Advantages And Features Of Object Oriented Programming

https://www.cs.drexel.edu/~introcs/Fa15/notes/06.1_OOP/Advantages.html?CurrentSlide=3


What do you feel are the benefits to object-oriented programming?

What are overloading and overriding? How do we implement those in Java?

--Originally published at diegotc2016

 

Overloading: two methods are overloaded if  both methods have the same name but different argument types.

For example:

class DisplayOverloading
{
    public void disp(char c)
    {
         System.out.println(c);
    }
    public void disp(char c, int num)  
    {
         System.out.println(c + " "+num);
    }
}
class Sample
{
   public static void main(String args[])
   {
       DisplayOverloading obj = new DisplayOverloading();
       obj.disp('a');
       obj.disp('a',10);
   }
}

The output would be:

a
a 10

Overriding: is when someone declares a method in subclass which is already present in parent class.

For example:

class Human{
   public void eat()
   {
      System.out.println("Human is eating");
   }
}
class Boy extends Human{
   public void eat(){
      System.out.println("Boy is eating");
   }
   public static void main( String args[]) {
      Boy obj = new Boy();
      obj.eat();
   }
}

The output would be:

Boy is eating

What are overloading and overriding? How do we implement those in Java?

I got this information out of:

Method Overloading in Java with examples

Method overriding in java with example

http://javarevisited.blogspot.mx/2011/12/method-overloading-vs-method-overriding.html

What are overloading and overriding? How do we implement those in Java?


What are overloading and overriding? How do we implement those in Java?

What are overloading and overriding? How do we implement those in Java?

--Originally published at diegotc2016

 

Overloading: two methods are overloaded if  both methods have the same name but different argument types.

For example:

class DisplayOverloading
{
    public void disp(char c)
    {
         System.out.println(c);
    }
    public void disp(char c, int num)  
    {
         System.out.println(c + " "+num);
    }
}
class Sample
{
   public static void main(String args[])
   {
       DisplayOverloading obj = new DisplayOverloading();
       obj.disp('a');
       obj.disp('a',10);
   }
}

The output would be:

a
a 10

Overriding: is when someone declares a method in subclass which is already present in parent class.

For example:

class Human{
   public void eat()
   {
      System.out.println("Human is eating");
   }
}
class Boy extends Human{
   public void eat(){
      System.out.println("Boy is eating");
   }
   public static void main( String args[]) {
      Boy obj = new Boy();
      obj.eat();
   }
}

The output would be:

Boy is eating

What are overloading and overriding? How do we implement those in Java?

I got this information out of:

Method Overloading in Java with examples

Method overriding in java with example

http://javarevisited.blogspot.mx/2011/12/method-overloading-vs-method-overriding.html

What are overloading and overriding? How do we implement those in Java?


What are overloading and overriding? How do we implement those in Java?

Delegation

--Originally published at diegotc2016

Delegation is when a class “delegates” another class to do something.

Delegate is to give the power you have to do something to another person in order to do something.

In OOP delegation is when a class gives one or more functionalities to another class in order to do something.

Here’s an example:

Some parents want to go out. They hire a babysitter and tell her to look after the baby.
But what if the baby gets sick?
There’s a note on the fridge door. “In case of emergency phone Helen 555-3141”

This is a pretty good analogy for delegation. Helen is the
delegate.

//within the parent class
babysitter.delegate = helen
[babysitter lookAfter:baby]

//within the babysitter class
if (baby.isSick)
{
[delegate callAbout:baby]
}

When assigning actions to an object, you can provide that object with a delegate. The delegate will be called when the object needs to inform something or do something beyond the scope of the object.

Delegation

Where I got this information from?

http://es.thefreedictionary.com/delegar

https://www.quora.com/What-is-delegation-in-object-oriented-programming

https://es.wikipedia.org/wiki/Delegaci%C3%B3n_(inform%C3%A1tica)

 


Delegation

Object Oriented Analysis and Design

--Originally published at diegotc2016

Understanding the object-oriented analysis and design processes

There’s a process in order to identify the classes in an application.

  1. Gather Requirements: What’s the program you trying to solve? What does the app do?
  2. Describe the app: Write in a coloquial way how people use the app. You could create a mockup or a prototype of the app.
  3. Identify the main objects: With the two last points you’re trying to get the most important ideas that are essential for the app to work.
  4. Describe the Interactions: Specify how one class interacts with another. For example: A  customer opens his/her bank account.
  5. Create a class diagram: A visual representation of the classes you need

Object Oriented Analysis and Design

Defining Requirements

There are two types of requirements:

  • Functional: What does it do? Features and Capabilities. For example: Application must allow user to search by customer’s last name, telephone number and order number.
  • Non-Functional: What else? Help, Legal, Performance, Support  and Security. System must respond to searches within two seconds.

FURPS/FURPS+

Functional Requirements

Usabilitity Requirements

Reliability Requirements

Performance Requirements

Supportability Requirements

+ Design Requirements, Implementation Requirements, Interphase Requirements, Physichal Requirements.

Introduction to the Unified Modeling Language (UML)

The UML isn’t a programming language, it is a graphical notation for drawing diagrams of an object oriented system

  • Name of the class: BankAccount
  • Attributes: accountNumber, balance, dateOpened, accountType
  • Behaviors: open(), close(), deposit(), withdraw()

 


Object Oriented Analysis and Design

What are the mechanics for class description (coding) in the JavaProgramming Language?

--Originally published at diegotc2016

Classes are defined by the following way:

class MyClass {
    // field, constructor, and 
    // method declarations
}

In the space that is between the braces you can give instrucitons, you can define objects or declarations that will make your code work. 

You can also get the name subclasses and superclasses. This can be represented in the next way: 

class MyClass extends MySuperClass implements YourInterface {
    // field, constructor, and
    // method declarations
}

The following means that MyClass is a subclass of MySuperClass and that it implements the YourInterface interface. 

You can also modify the classes from the beginning. Class declarations can include these components, in order:

  1. Modifiers such as public, private, and a number of others that you will encounter later.
  2. The class name, with the initial letter capitalized by convention.
  3. The name of the class’s parent (superclass), if any, preceded by the keyword extends. A class can only extend (subclass) one parent.
  4. A comma-separated list of interfaces implemented by the class, if any, preceded by the keyword implements. A class can implement more than one interface.
  5. The class body, surrounded by braces, {}.

I got this out of:

https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html

and I received help from the teacher

What are the mechanics for class description (coding) in the JavaProgramming Language?


What are the mechanics for class description (coding) in the JavaProgramming Language?