Encapsulation or Modularization in Object Oriented Programming
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.









Leave your response!