Encapsulation Vs Abstraction – revisited

OOPs Concepts

  1. Inheritance
  2. Polymorphism
  3. Abstraction
  4. Encapsulation

The first two Inheritance and polymorphism has been pretty straight to understand,

  1. Inheritance à the child class get the properties of the parent class, and so on
  2. Polymorphism -> the object behaves differently in different situations basically polymorphic, it can be achieved by over loading and with help of inheritance and overriding concepts.

Coming to the Abstraction and encapsulation, they both are bit confusing.

Both are telling to hide some information. But ways are different.

  1. Encapsulation suggests to hides the information by restricting the access of the class, methods, members.

whereas

  1. Abstraction suggests to hides the information, (actual implementation of the objects behaviour) By using the Interfaces and abstract classes to show the behaviours (public methods) and you implement them in concrete classes. So that the client only sees the public methods, you can always improve the concrete implementations in later versions.

What are the advantages we get if we follow Oops principles?

Well you can develop better software.

  • Flexibility – always possible to provide more advance implementations
  • Modular – so parallel development possible, easy to debug without effecting other modules
  • Easy to maintain
  • Makes easy for performance tuning
  • Code reusability
  • The entire system mail fail but the individual module may work properly so we can always make things right.
Advertisements

About sivateja

I am a professional graduate..I am passionate about Latest Technology.
This entry was posted in java, Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s