3 Benefits Of Encapsulation You Must Know
An important factor that distinguishes a well-designed component from a poorly designed one is the degree to which the component hides its internal data and implementation details from other components.
A well-designed component hides all its implementation detail and cleanly separates its API from its implementation.
Components communicate through their APIs and are oblivious to their inner workings. This concept is known as encapsulation and here are 3 benefits that you should know.
1. Components are decoupled
Components can be developed, tested, modified and optimized in isolation. This speeds up development time because components can be developed in parallel.
2. Increased flexibility
When components are decoupled, Components can be understood quickly, debugged and modified with little fear of harming other components.
3. Ease of code reuse
Encapsulation increase software reuse because components that are not tightly coupled are often useful in other context other than the ones in which they were originally developed for.