Topic 15: Object-oriented Design I
Synopsis
- Produces a set of class¤ hierarchies and
and specification of class¤ interactions
which solve the specified problem
- Cellular analogy
- Build a hierarchical system
from a small number of independent standard
components
- System behaviour¤ "emerges" from the interactions
of those components at various levels
- Discovery and invention
- System will be "noun-based", not "verb-based"
- Abstraction¤:
Collect common structure and behaviour¤ in
more abstract classes¤
- Encapsulation¤:
Isolate internals to reduce interdependence
- Aggregation¤:
Build classes¤ out of simpler classes¤ (inheritance),
build objects out of simpler objects (members¤)
- Polymorphism¤:
Control behaviour¤ at the highest possible level of
abstraction¤ (let the objects work out the details
themselves)
- Find the objects
- Find the classes¤
- Specify the relationships
- Design the interactions
- Refine the design
- Write a NL description of the problem
- Nouns may represent objects
- Verbs may represent object behaviours¤ (methods)
or occasionally events to be modelled as objects
- Adjectives may indicate specializations¤ (child classes¤¤)
or independent properties (mixin¤ classes¤)
- Examine the existing system (automated or manual)
- What things do the current domain experts talk about when
describing it?
- Examine similar applications (automated or manual)
- Does this thing have a well-defined role in
the problem domain?
- Does this thing have well-defined boundaries in
the problem domain?
- Does this thing have a well-defined behaviour¤ in
the problem domain?
- If any answer is "no", it's probably not a single object
- Example: engine, car, traffic
- Example: client, clients, clientele
- Classification¤ is hard - "No silver bullet" (Brooks)
- Discovery vs Invention
- Iterative
- Restructuring operations:
abstraction¤, factorization, composition
- Classical (Platonic)
- A priori clustering
- Prototype theory
- Analogical approaches
- Cluster according to important common properties (Plato)
- ..and/or according to common effects (Aquinas)
- Also known as emergent classification¤
(classes¤ emerge from the collection of objects)
- Works well if the important common properties used
are significant in the domain
- "Bottom-up" approach
- Example: early zoological classification¤
- Formulate the concepts which distinguish
objects first
- Match objects to each concept to classify
- Works well if the concepts selected
are significant in the domain
- "Top-down" approach
- Example: Racism
- Select a "paradigm" ("perfect example") object for each
potential class¤
- Cluster objects which are like the paradigm object
into the same class¤
- Works well if the example object really is
representative.
- "Instance¤-outwards" approach
- Example: Exam marking
- Find an existing system which is a strong
analogue for the proposed system
- Generate classes¤ for the new system by
"reversing the analogy"
- Works well if the analogy works well
(i.e. depends on creativity and experience)
- "Concept-backwards" approach
- Example: Ant roles
- Pressman: Chapters 20 - 22
- Sommerville: Chapter 12
- Stroustrup: Chapters 23 to 25
- Schach: Chapters 12 and 13
This material is part of the CSE2305 - Object-Oriented
Software Engineering course.
Copyright © Jon McCormack & Damian Conway, 1998–2005. All rights
reserved.