Subscribe by Email

Wednesday, July 29, 2009

Quick Tech Tip: Encapsulation - What does it mean ?

Encapsulation is not a common word in the English language; however, it is an important phrase in the word of software design, especially in the world of Object Oriented Programming. So what does encapsulation mean ?
In computer science, the principle of information hiding means the hiding of design decisions in a computer program, those decisions that are most likely to change, thus protecting other parts of the program from change; especially if the design decision is changed. The protection involves providing a stable interface which shields the remainder of the program from the implementation (the details that are most likely to change). The purpose is to achieve potential for change: the internal mechanisms of the component can be improved without impact on other components, or the component can be replaced with a different one that supports the same public interface.
The term encapsulation is often used interchangeably with information hiding, while some make distinctions between these two terms (although to most people these terms seem the same). It seems that people, however, fail to agree on the distinctions between information hiding and encapsulation though one can think of information hiding as being the principle and encapsulation being the technique. A software module hides information by encapsulating the information into a module or other construct which presents an interface.
The concept of encapsulation is a term that is an integral part of object-oriented programming, where the interface to an object is defined by its public methods, while its internal state is represented by private data. Encapsulation is a good principle of object oriented design, and part of well designed systems.

No comments:

Facebook activity