L4.1 Class Diagram
L4.1 Class Diagram
L4.1 Class Diagram
Based Modeling
.
Class Diagram
1. Noun-phrase approach
2. Common Class patterns
3. Class-Responsibility-Collaborator
4. Use-Case driven approach
1. Noun-phrase approach
14
Guidelines for Identifying a Super-sub
Relationship
• Top-down
Look for noun phrases composed of adjectives in a
class name.
• Bottom up
Look for classes with similar attributes or methods
Identifying the Composition &
Aggregation/a-part-of Relationship
• Composition - a physical whole is constructed from physical parts
(Assembly)
Eg1: Building constructed by bricks, stones
Eg2: ATM with Card Reader, Console, Printer, Key Pad
29
Creating CRC Cards
• The name of a class at the top
• The responsibilities of the class on the left
hand side
• The collaborators of the class on the right
hand side of the card
30
Creating CRC Cards
31
Use-Case Driven Approach
• Identify the active entities in the system
(actor)
• Identify business domain (“passive”) entities
in the system (reflect business domain hence
potential class)
ATM Case Study –System Requirements
• The bank client must be able to deposit an amount to and withdraw
an amount from his or her accounts using the touch screen at the
ATM kiosk. Each transaction must be recorded, and the client must
be able to review all transactions performed against a given
account. Recorded transactions must include the date, time,
transaction type, amount and account balance after the transaction
41
Revised class model for Library System
.
42
Design concepts
Functional Independence
Cohesion – is an indication of the relative functional
strength of a module
Coupling – is an indication of the relative
interdependence among modules