LESSON05 Jerry Kotuba Object Oriented Methodologies 1.
-
Upload
erick-goodwin -
Category
Documents
-
view
220 -
download
0
Transcript of LESSON05 Jerry Kotuba Object Oriented Methodologies 1.
LESSON05Jerry Kotuba
Object Oriented Methodologies 1
Agenda
Jerry KotubaObject Oriented Methodologies
2
Solution I-C-E-03 & 04 Posted Take up the Class Diagrams
Class Diagrams Whole-to-part associations I-C-E-05
3
SYST39409 - Object Oriented Methodologies
Generalization, Inheritance & Constraints
generalization path solid line with hollow
arrowhead pointing from subclass to superclass
indicate basis of generalization
name the path for the attribute being removed = called the discriminator
discriminator shows which property is abstracted by a generalization relationship
Jerry Kotuba
4
SYST39409 - Object Oriented Methodologies
Constraints on Generalization
constraints on the subclasses
overlapping: descendent may be descended from more than one of the subclasses student can be both a
research and teaching assistant
disjoint: descendent may not be descended from more than one of the subclasses patient can not be both
out and residentJerry Kotuba
5
SYST39409 - Object Oriented Methodologies
Constraints on Generalization
complete: all subclasses are listed only have out and
resident patients incomplete: all
subclasses are not listed more subclasses are
available can have casual, part-
time employees
Jerry Kotuba
Object Oriented Methodologies
6
Whole-to-Part Associations
The UML provides ways to model two types of whole-to-part associations – aggregation and composition.
Jerry Kotuba
Object Oriented Methodologies
7
Definitions
aggregate: In an aggregation, the class representing the whole.
aggregation: An association between classes representing a part-to-whole relationship in which the parts and the whole may exist independently and in which a single part may be associated with more than one whole at the same time.
Jerry Kotuba
Object Oriented Methodologies
8
Definitions…cont’d
composite: In a composition, a class representing the whole.
composition: An association between classes representing a whole-to-part relationship in which the parts may belong to only one whole at a time and the whole does not exist without its parts.
Jerry Kotuba
Object Oriented Methodologies
9
Example of an Aggregation
.
Jerry Kotuba
Object Oriented Methodologies
10
Example of a Composition
.
Jerry Kotuba
Object Oriented Methodologies
11
Aggregation and Composition
.
Jerry Kotuba
Object Oriented Methodologies
12
Categories of Whole-to-Part Associations
There are three relationships that sometimes occur in an object model: Assemblies of parts Members of groups Containers and their contents
You may find these useful for making your model a better tool for understanding and communication.
The model can always be built without these. They do not really affect its use for system design, just for talking to the users.
Jerry Kotuba
Object Oriented Methodologies
13
Assemblies of parts
Taking something apart into its components is a technique we humans often use to understand how something works.
Often we find it improves our understanding to model A product and its components A business consists of branches,
departments, etc. A country consists of states, provinces,
counties, boroughs, shires, towns, villages, cities, etc.
Jerry Kotuba
Object Oriented Methodologies
14
Containers and their contents Container-Contents is a different and less
common relationship. In some situations we may find it helpful to
view a relationship as one of these, e.g., Truck or Aircraft and the Products or Shipments that
it carries An actual shipping container and the goods it holds A ship, bus or airplane and its passengers A building and the businesses it houses.
Jerry Kotuba
Assemblies of parts Vs Containers and their contents
The essential difference between these relationships is that: With Assemblies of
parts, if you take the component away, the assembly (whole) probably won’t work any more Take a wheel off a
car Take a hand off a
clock Take a leg off a table.
A Container, however, is still a perfectly good Container, even without its Contents The jar is still OK even
without the “hunny.” And the Contents are
perfectly OK without the Container (although the “hunny”
might get all over one’s paws!)
Jerry Kotuba Object Oriented Methodologies 15
Collection-Member (members of groups)
Collection-Member is also a different and relatively uncommon relationship.
Sometimes we meet an actual collection: A library full of books An art gallery A stamp or jewelry
collection A fleet of trucks, ships or
aircraft
Other times it may help to use this to describe: A church, club or
regiment and its members
An inventory of furniture or equipment
A herd, mob, flock, school or skein of animals.
Jerry Kotuba Object Oriented Methodologies 16
Object Oriented Methodologies
17
Your Turn…
Jerry Kotuba
Think about a book, which consists of a cover, table of contents, chapters and an index. Chapters in turn have pages, paragraphs and words. Show the special case of association between classes described here including the multiplicity.
Next class…
Jerry KotubaObject Oriented Methodologies
18
Wrap-up Class Diagrams Test Review Return Assignment No 1 Quiz No 2
Object Oriented Methodologies
19
Your turn…ICE-05
SLATE2
Jerry Kotuba