Friday, December 25, 2009

ABOUT OBJECT ORIENTED PROGRAMMING

The main concept of Object Oriented Programming (OOP) is to combine data(s) and function(s). We can imagine an object as a department in a university. There are lots of departments in a university. It means: there are lots of objects.

Each department has its own function. Electrical engineering dept. has the objective to produce electrical engineering scholars. Meanwhile, accounting department has to produce accounting scholars. But, both have the same mission. It's to reach university's vision, such as to form good generations.

If a department wants to reach its objectives, it must have a workplan and executors (who will execute the plans). In OOP, it means: an object must have data (instant variables) and function (methods).

In OOP, a university can be analogized as a "class," because class - itself - means: the unit of several objects. So, we can draw the relationship among data; function; object; and class such the graphic below.



OOP has the characteristics below:
  1. Encapsulation means that data and function have the same position in an object. Usually, data is treated as the second component - after the function.
  2. Inheritance means that a class' characteristic can also be generated to another class. If a whale has a large size, the other whales can also have the large size.
  3. Polymorphism means that one thing is possible to have more than one form. Water is possible to be solid, fluid, or gas.

No comments:

Post a Comment

Please type your comment here!