OOPortal OOPortal


Design Concepts  «Prev  

Encapsulation

Two phases of object Definition

Defining objects is best accomplished in two phases.
  1. First, define the encapsulated view of the object by defining only the purpose and the interface.
  2. Then define the internal workings, the implementation of the data and behavior that support the purpose and interface. Over time, the purpose and interface will remain relatively stable, but the implementation can change as often as needed without disruption to other objects. The object may even be replaced with another object with the same purpose and interface but an entirely different implementation.

It is also useful to distinguish encapsulated knowledge from explicit knowledge. Encapsulated knowledge is not precisely explicit, even though this term has generally been paired with implicit knowledge, because it is knowledge concealed from its users, and explicitness implies observability.
Encapsulated knowledge is distinguishable from codified knowledge primarily along the dimension of observability which has implications for the appropriability of value. The observability of explicit, codified knowledge makes it susceptible to misappropriation. Encapsulated knowledge, on the other hand, facilitates the marketing of knowledge since it can only be partially misappropriated through expensive reverse engineering.
Finally, both codification and encapsulation are motivated by a desire to inexpensively transfer knowledge. While codification is a process that reduces complexity, encapsulation preserves complexity. The value of encapsulation lies in the avoidance of the cost of learning to make use of the encapsulated knowledge. For example, utility can be realized from the use of knowledge encapsulated in a computer or an automobile apart from having to learn why they work. The vast majority of transactions that occur in consumer markets involve the purchase of some form of encapsulated knowledge.