Professional Documents
Culture Documents
1
Models
• A model is a simplified representation or abstraction of
reality.
• Reality is generally too complex to copy exactly
• Much of the complexity is actually irrelevant in
problem solving
2
Degrees of Model Abstraction
(Least to Most)
• Analog Model behaves like the real system but does not
look like it (symbolic representation)
3
Benefits of Models
1. Time compression
2. Easy model manipulation
3. Low cost of construction
4. Low cost of execution (especially that of errors)
5. Can model risk and uncertainty
6. Can model large and extremely complex systems with
possibly infinite solutions
7. Enhance and reinforce learning, and enhance training.
4
Types of UML Diagrams
• Class Diagram
• Sequence Diagram
• Collaboration Diagram
• State Diagram
<<extend>>
Use Case Diagrams
Borrow
Employee
Client
Order Title
Fine Remittance
Supervisor
(TogetherSoft, Inc)
Use Case Diagrams(cont.)
Name
Account_Name
- Customer_Name
Attributes
- Balance
+addFunds( ) Operations
+withDraw( )
+transfer( )
OO Relationships
Regular Loyalty
Customer Customer
Subtype1 Subtype2
or: Customer
- Generalization expresses a
parent/child relationship among related
classes.
- Used for abstracting details in several Regular Loyalty
layers Customer Customer
OO Relationships: Association
student
1 *
University Person
0..1 *
employer teacher
Role
Multiplicity
Symbol Meaning
1 One and only one Role
0..1 Zero or one “A given university groups many people;
M..N From M to N (natural language) some act as students, others as teachers.
* From zero to any positive integer
A given student belongs to a single
university; a given teacher may or may not
0..* From zero to any positive integer
be working for the university at a particular
1..* From one to any positive integer time.”
Class Diagram
Name Order class
-dateReceived
Multiplicity: mandatory
Attributes -isPrepaid Customer
-number :String
-price : Money
* 1 -name
-address
+dispatch() Association +creditRating() : String()
Operations +close()
1
{if Order.customer.creditRating is Generalization
"poor", then Order.isPrepaid must
be true }
Class Student {
Course enrolls[4];
}
Class Course {
Student have[];
}
OO Relationships: Composition
Composition: expresses a relationship among instances
Whole Class of related classes. It is a specific kind of Whole-Part
Class W relationship.
Apples Milk
• Aggregations may form "part of" the aggregate, but may not
be essential to it. They may also exist independent of the
aggregate.
e.g. Apples may exist independent of the bag.
Good Practice: CRC Card
(Class Responsibility Collaborator)
Benefits: It is easy to describe how classes work by moving
cards around; allows to quickly consider alternatives.
Class Collaborators
Reservations • Catalog
• User session
Responsibility
• Keep list of reserved titles
• Handle reservation
Sequence Diagram(make a phone call)
Picks up
Dial tone
Dial
Picks up
Hello
Sequence Diagram:Object interaction
A B
[condition] remove()
Condition
*[for each] remove()
Iteration
Self-Call
Sequence Diagrams – Object Life Spans
• Creation
A
– Create message
– Object life starts at that point
• Activation Create
B
– Symbolized by rectangular stripes
– Place on the lifeline where object is
activated.
– Rectangle also denotes when object
is deactivated.
• Deletion Activation bar
X
Return
– Placing an ‘X’ on lifeline Deletion
– Object’s life ends at that point Lifeline
Sequence Diagram
1: look up ()
2: title data ()
4 : title returned ()
5: hold title ()
5 : title available ()
6 : borrow title ()
start
6: remove reservation
5: title available
6 : borrow title
1: look up
2: title data
4 : title returned
Catalog
5 : hold
•Shows the relationship between objects and the order title
of messages passed between them.
between them.
•The objects are listed as rectangles and arrows indicate the messages being passed
•The numbers next to the messages are called sequence numbers. They show the sequence
time sequence.
State Diagrams
(Billing Example)
Start End
Unpaid Paid
Invoice created payin Invoice destroying
g
State Diagrams
(Traffic light example)
Yellow
Green
Event
UML Modeling Tools
• Others (http://www.objectsbydesign.com/tools/umltools_byCompany.html )