Model Refinement   «Prev  Next»
Lesson 3 Encapsulation revisited
ObjectiveReinforce the Principle of Encapsulation

Reinforce Encapsulation Principle

Specification versus Implementation

The purpose of encapsulation is to separate the specification of an object from its implementation. This separation allows you to use an object without knowing how it is implemented. Because the implementation is hidden, you have the freedom to apply new techniques and technologies to improve the implementation without corrupting the object's purpose and without affecting the other objects that collaborate with it. Unfortunately, we tend to think of objects only as instances of classes in the literal syntax of programming languages. But encapsulation applies to objects at every level of abstraction.

Objects Redefined

An object in the most basic sense is simply an entity. For an analyst, an object could be a unique physical entity, an aggregation of objects, a component, an application, a job, a system, or even a department or a company. Encapsulation is essential at all levels of abstraction in both software and user domains.
The following slide show contains several examples of objects.
 <em>Purpose:</em> A resource provided to clients for short-term loan
1) Purpose: A resource provided to clients for short-term loan

<em>Aggregate:</em> A car; Purpose: A means of personal transporation.
2) Aggregate: A car; Purpose: A means of personal transporation.

<em>Component:</em> A security user interface; Purpose: provide controlled visual access to the security system
3) Component: A security user interface; Purpose: provide controlled visual access to the security system

Purpose: Insure that employers are piad according to company policy
4) Purpose: Insure that employers are piad according to company policy

Purpose: Support the creation and alteration of electronic documents.
5) Purpose: Support the creation and alteration of electronic documents.

Purpose: Facilitate and track the payment of all employers in compliance with company policy and state and federal tax laws
6) Purpose: Facilitate and track the payment of all employers in compliance with company policy and state and federal tax laws

Purpose: Coordinate the staff and systems used to insure the proper payment of employees according to company policy and state and federal laws.
7) Purpose: Coordinate the staff and systems used to insure the proper payment of employees according to company policy and state and federal laws.

Purpose: Provide expert support for all payroll related services for client companies in conformance with state and federal laws.
8) Purpose: Provide expert support for all payroll related services for client companies in conformance with state and federal laws.


Encapsulation reveals Opportunities

When applied consistently to the analysis process, encapsulation often reveals opportunities to redesign not just the software but also the problem domain practices and organization. This opportunity addresses one of the reasons that companies have not received the benefits of object-oriented methods, that is, the fact that the systems development process is not closely linked to the business reengineering process. In fact, you will see in the following lessons that refactoring applies equally well to organizational systems and software systems.

Refactoring Encapsulation - Quiz

Click the Quiz link below to take a short multiple-choice quiz.
Refactoring Encapsulation - Quiz