Commonality/Variability and Abstract Classes

Consider Figure 8-4. It shows the relationship between

Figure 8-4. The relationship between commonality/variability analysis, perspectives, and abstract classes.


  • Commonality/variability analysis

  • The conceptual, specification, and implementation perspectives

  • An abstract class, its interface, and its derived classes

As you can see in Figure 8-4, commonality analysis relates to the conceptual view of the problem domain and variability analysis relates to the implementation, that is, to specific cases.

The specification perspective lies in the middle. Both commonality and variability are involved in this perspective. The specification describes how to communicate with a set of objects that are conceptually similar. Each of these objects represents a variation of the common concept. This specification becomes an abstract class or an interface at the implementation level.

In the new perspective of object-oriented design, I can now say the following:

Mapping with Abstract Classes Discussion
Abstract class → the central binding concept An abstract class represents the core concept that binds together all of the derivatives of the class. This core concept is what defines the commonality.
Commonality → which abstract classes to use The commonalities define the abstract classes I need to use.
Variations → derivation of an abstract class The variations identified within that commonality become derivations of the abstract classes.
Specification → interface for abstract class The interface for these classes corresponds to the specification level.

This simplifies the design process of the classes into a two-step procedure:

When Defining … You Must Ask Yourself…
An abstract class (commonality) What interface is needed to handle all of the responsibilities of this class?
Derived classes Given this particular implementation (this variation), how can I implement it with the given specification?

The relationship between the specification perspective and the conceptual perspective is this: It identifies the interface I need to use to handle all of the cases of this concept (that is, the commonality).

The relationship between the specification perspective and the implementation perspective is this: Given this specification, how can I implement this particular case (this variation)?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.204.102