Encapsulation or Modularization in Object Oriented Programming - Java
Home » Java

Encapsulation or Modularization in Object Oriented Programming

11 December 2009 No Comment

Encapsulation is hiding information. Encapsulation hides implementation details from world and exposes only the contract. In case of a class, the methods exposed without private access modifier defines the contract of that class. How these methods are implemented is never known to the users of these methods.

Encapsulation can be implemented at many levels. It can be at attribute, method, class, package, module, application and even at organization level. At each level we define the boundary and hide something which is implementation. Exposed interfaces do the contract definition job.

What do we achieve by modularization?

- The main advantage of it is ease of modification. As the clients of unit are concern about the interface/contract only, the internal implementation can vary independent of client.

- This mean loose coupling amongst different units.

- Independent packaging and deployments can be looked at.

- Maintainability is imporoved.

 

More Related Posts in Java

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.