Page 163 - DCAP308_OBJECT_ORIENTED_ANALYSIS_AND_DESIGN
P. 163
Unit 13: Class Design
Corollary 1 – Uncoupled design with less information content: Highly cohesive objects Notes
can improve coupling because only a minimal amount of essential information need be
passed between objects.
Corollary 2 – Single purpose: Each class must have a single, clearly defined purpose. While
documenting, one should be able to describe the purpose of a class in few sentences.
Corollary 3 – Large number of simple classes: Keeping the classes simple allows reusability.
Corollary 4 – Strong mapping: There must be a strong association between the physical
system (analysis’s objects) and logical design (design’s object).
Corollary 5 – Standardisation: Promote standardization by designing inter changeable
components and reusing existing classes or components.
Corollary 6 – Design with inheritance: Common behavior (methods) must be moved to
super classes. The superclass-subclass structure must make logical sense.
Corollary 1: Uncoupled Design with Less Information Content
Coupling is a measure of the strength of association established by a connection from one object
or software component to another. Coupling is a binary relationship. It is important for design
because a change in one component should have a minimal impact on the other components.
Notes The degree or strength of coupling between two components is measured by the
amount and complexity of information transmitted between them.
Object oriented design has two types of coupling: interaction coupling and inheritance coupling.
1. Interaction coupling: Interaction coupling involves the amount and complexity of messages
between components. It is good to have little interaction. The general guideline is to keep
the message as simple and infrequent as possible. Objects connected to many complex
messages are tightly coupled, meaning any change to one invariably leads to a ripple
effect of changes in others.
For types of coupling among objects or components, refer Table 13.1 as below:
Table 13.1: Types of Coupling among Objects or Components
Degree of Coupling Name Description
Very High Content Coupling Connection involves direct reference to
attributes or methods of another object
High Common Coupling Connection involves two objects accessing a
‘global data space’, for both to read & write
Medium Control Coupling Connection involves explicit control of the
processing logic of one object by another
Low Stamp coupling Connection involves passing an aggregate data
structure to another object, which uses only a
portion of the components of the data structure
Very low Data coupling Connection involves either simple data items or
aggregate structures all of whose elements are
used by the receiving object. ( this is the goal of
an architectural design)
LOVELY PROFESSIONAL UNIVERSITY 157