Object-oriented design -- decomposition into objects
- application/system/class oriented
Identifying objects -- responsibilities
Layers of abstraction
- components, subsystems, frameworks
slide: Object-oriented design
Objects -- crisp entities
- object = an entity that suffers and requires actions
The method:
- Identify the objects and their attributes
- Identify operations suffered and required
- Establish visibility/interface
slide: The Booch method
Heuristics
- model of reality -- balance nouns (objects) and verbs (operations)
Associations
- directed action -- drives, instructs
- communication -- talks-to, tells, instructs
- ownership -- has, part-of
- resemblance -- like, is-a
- others -- works-for, married-to
slide: Heuristics for modeling
Candidate classes
ATM
- account -- represents the customer's account in the banks database
- atm -- performs financial services for a customer
- cardreader -- reads and validates a customer's bankcard
- cashdispenser -- gives cash to the customer
- screen -- presents text and visual information
- keypad -- the keys a customer can press
- pin -- the authorization code
- transaction -- performs financial services and updates the database
slide: The ATM example (1)
Eliminating spurious classes
- vague -- system, security-provision, record-keeping
- attribute -- account-data, receipt, cash
- redundant -- user
- irrelevant -- cost
- implementation -- transaction-log, access, communication
Good classes
slide: Eliminating spurious classes
Object-oriented thinking
CRC
- Immerse the reader in the {\em object-ness} of the material
- Give up global knowledge of control
- Rely on the local knowledge of objects
OO design with CRC cards
- Class, Responsibility, Collaborators
slide: The CRC method
Object roles
- actor -- operates (suffers no operations)
- server -- suffers operations
- agent -- suffers and operates ( actor & server)
slide: Object roles
analyze a little,
design a little,
implement a little,
test a little ...