Page 58 - DCAP308_OBJECT_ORIENTED_ANALYSIS_AND_DESIGN
P. 58
Object Oriented Analysis and Design
Notes
Figure 5.1: An Abstract Class
Source: http://www.pearsonhighered.com/assets/hip/us/hip_us_pearsonhighered/samplechapter/
0131238299.pdf
The legend abstract indicates an abstract superclass. You may define abstract operations for
abstract classes. An abstract operation species the signature of an operation, while deferring
implementation to the subclasses. The signature of an operation species the argument types, the
result type, exception conditions, and the semantics of the operation. The notation for an abstract
operation is the legend {abstract} following the operation name.
Self Assessment
Fill in the blanks:
1. An ......................... is a class that has no direct instances.
2. An abstract operation species the signature of an operation while deferring implementation
to the .........................
3. The ......................... of an operation species the argument types, the result type, exception
conditions, and the semantics of the operation.
5.2 Constraints
A constraint is a functional relationship between modeling constructs such as classes, attributes,
and associations. A constraint restricts the values of data. You may place simple constraints in
the object model. You should specify complex constraints in the functional model.
A “good” model should capture many constraints with its very structure. In fact, the ability of a
model to express important constraints is one measure of the quality of a model. Most object
models require several iterations to strike a proper balance between rigor, simplicity, and
elegance. However, sometimes it is not practical to express all important constraints with the
structure of a model.
Constraints are denoted by text in braces (“{“ and “}”). The text of a constraint should clearly
indicate the affected data. Similarly, comments are also delimited by braces. We often use
comments to document the rationale for subtle modeling decisions and convey important
enumerations.
Did u know? Sometimes it is useful to draw a dotted arrow between classes or associations
to indicate the scope of a constraint.
Example: In Figure 5.2 a table has many columns; the primary key columns are a subset
of the overall columns.
52 LOVELY PROFESSIONAL UNIVERSITY