Introduction To Object-Oriented Design and The UML
Introduction To Object-Oriented Design and The UML
Object-Oriented Design
and the UML
Object-Oriented Modeling
Facilitate Borrow
Librarian Borrower
Search for Book
Facilitate Return
Class Diagrams
and CRC Cards
1: checkIfDelinquent()
3: borrowBook()
4: setBorrower()
:Borrower
Example:
State Diagram (Book)
start
Reserved
New Borrowed
Static Model
Class Diagrams
Dynamic Model
Use Cases, Interaction Diagrams, State
Diagrams, others
OO Static Model
Class Diagrams
Relationships
Association
Aggregation/Composition
Inheritance
Attribute and Method names
Classes in a Class Diagram
Inheritance (arrow)
example: between Secretary and Employee
Composition/Aggregation (diamond)
example: between Car and Wheel
Association (line)
example: between Borrower and Book
Inheritance
Employee
Secretary
Composition
4
Car Wheel
w[]
0..1 0..3
Borrower Book
currBorr bk[]
Goal: Represent
Object behavior
Object interaction
Traditional (relational) Dynamic Modeling
Data Flow Diagrams (DFDs)
Problem: Processes separate from data
Need modeling notation that highlight tight
relationship between data & processes
DFD Example
(Inventory Management)
Delivery info
Accept and Post
Delivery
Transaction
Item Master
OO Counterpart:
Object Interaction
new (delivery info)
Encoder :Transaction
:Item Master
Interaction Diagrams
Rectangles: Classes/Objects
Arrows: Messages/Method Calls
Labels on Arrows
sequence number
method name
more details, when necessary (conditions,
parameters, types, return types)
Interaction Diagram:
Borrow-Book Example
2: avail = checkIfAvailable():boolean
Borrow
Screen
b:Book
1: delinq = checkIfDelinquent():boolean
3:[!delinq & avail] borrowBook(Book b)
4: setBorrower(r)
r:Borrower
Methods