Friday, December 01, 2006

OOP

I want to write a summary for OOP for a long while; however just can not find a time slopt and sit down to think and write about it. As of I just finished my two exams yesterday, I think it is a good time to drop some lines about OOP now.

Features and Characteristics:
Class --> In oop, class is define the abstract characteristic of a thing. (Such as attributes and behaviors). Example, A class of dog can define a method hasFur () for property, bark()
Object --> An instance of a class. Example: Lassie is an instance of class Dog.
Method --> The abilities of the object, sO Lassie being a dog, it can bark()
Message passing --> An object send data to another object or invoke another object
Inheritance --> A class has subclass, and the subclass inheritance its parent class’s attributes and behavior.
Encapsulation --> Hiding detail of how particular class works from object. Fox example, every dog has a bark() method, but we don't necessary need to know how bark() is work. Encapsulation is archive by specify which class may use the member of tech object. Therefore the object is expose to any classes a certain interface.
Abstraction --> simplify complex reality by modeling class appropriate to the problem. Such as an Abstract class Animal, which contain general properties and behavior of animal
Polymorphisms -->Behavior that varies depend on the class in which behavior is invok. Two or more difference class react differently on the same message.


What are the advantage of oop?
* Model real world by associating data to the methods operate on them.
* Control access by apply public, private, protect, prevent access to memeber variable
* Easy to segregate various parts of a program
* Hiding disparate parts of a project from one another
* Inheritance , code reuse--> lead to fast development