Explain the advantages of Encapsulation in Object Oriented Programming Languages.
Benefits of Encapsulation in oops:
Encapsulation makes it possible to separate an objects implementation from its behavior to restrict access to its internal data. This restriction allows certain details of an objects behavior to be hidden. It allows us to create a "black box" and protects an objects internal state from corruption by its clients.
Encapsulation is a technique for minimizing interdependencies among modules by defining a strict external interface. This way, internal coding can be changed without affecting the interface, so long as the new implementation supports the same (or upwards compatible) external interface.
So encapsulation prevents a program from becoming so interdependent that a small change has massive ripple effects.
The implementation of an object can be changed without affecting the application that uses it for:
Improving performance, fix a bug, consolidate code or for porting.