lecture5_design_principles.pdf - CSC3380 Object Oriented Design Lecture 5 Design principles Last Class • Class extraction • First step in design •

lecture5_design_principles.pdf - CSC3380 Object Oriented...

This preview shows page 1 - 18 out of 53 pages.

CSC3380 Object Oriented Design Lecture 5: Design principles
Image of page 1
Last Class Class extraction First step in design Find important behaviors and nouns and create classes for them Try to guess the relationships between the classes (arrows) Simple vs compound UML Modelling language for design Used to specify patterns ATMs They’re pretty boring This Photo by Unknown Author is licensed under CC BY-SA
Image of page 2
This class More UML Design guidelines Ducks
Image of page 3
Quick review Basic features of a class rectangle Public/private/protected Delegation
Image of page 4
Quick review Composition
Image of page 5
Composition vs Delegation Composition is for owned objects. Delegation is for independent objects. [Class examples for each with UML] Customer/ATM Class/Student/University Racecar
Image of page 6
UML Cardinality/multiplicity
Image of page 7
Multiplicity Number means how many instances of the class are contained/delegated to. 01 The “..” establish a range: 2..5 means at least two, but up to five 1..* means at least one, but any number more 0..* or just * means any number 02 Usually implies a container if “*” 03
Image of page 8
Image of page 9
Duck simulator Example from Head First: Design Patterns SimUDuck is a duck simulator. “Duck” is a base class for all waterfowl.
Image of page 10
Base Class
Image of page 11