Tuesday, December 22, 2009

Object Oriented Concepts Every Dummy Must Know

Abstraction
  • Abstraction is Only showing what is necessary and encapsulating (hiding) unnecessary parts. 
    • If you take a car you interact with it using abstractions 
      • you use gas pedal, steering wheel which hides internal details
  • It is keeping a clear separation between abstract properties of a data type and the concrete details of its implementation. 
  • It is not presenting the details but only show the parts which are necessary.  
  • Hiding implementation 
To abstract properties we can use private modifier. Abstraction is hiding implementation details using abstract classes and interfaces.


Encapsulation
  • Hiding state/data. Information hiding mechanism
  • It is the opposite of Abstraction.  
http://stackoverflow.com/questions/24626/abstraction-vs-information-hiding-vs-encapsulation
https://www.google.com/search?q=encapsulation+vs+abstraction&ie=utf-8&oe=utf-8
http://stackoverflow.com/questions/742341/difference-between-abstraction-and-encapsulation

Composition : Combining simple types to make a complex type (Car composed of Wheels, Body etc.). An object of a composite type "has an" object of a simple type.


Aggregation : (See composition vs aggregation - adobe)

Is a form of object composition.

Inheritance : When an object or class based on another object or class. 

Inheritance is "is a" relationship while, composition is "has a" relationship

Articles

  • inheritance defined statically at compile time.
  • object composition defined dynamically at run time, through objects acquiring references to other objects
  • inheritance : reuse by subclassing : white box reuse (internals of parent are visible)
  • composition : well defined interfaces: black box reuse (no internal objects are visible)



updated: 2014

0 comments:

Post a Comment

Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook