UML basics UML distilled, a brief guide to the standard Modeling language, by Martin Fowler, 2000.
-
Upload
stephanie-york -
Category
Documents
-
view
241 -
download
2
Transcript of UML basics UML distilled, a brief guide to the standard Modeling language, by Martin Fowler, 2000.
ATM scenariofrom Object-Oriented Modeling and Design, by J.Rumbaugh, 1991
• The ATM asks the user to insert a card• The ATM accepts the card and reads its serial number• The ATM requests the password• The ATM verifies the serial number and password with the consortium, the
consortium checks it with the bank and notifies the ATM of acceptance• The ATM asks the user to select the kind of transaction (withdrawal, deposit, …).
The user select withdrawal• The ATM asks for the amount of cash• The ATM verifies that the amount is within predefined policy limits and asks the
consortium to process the transaction. The consortium passes the request to the bank, which eventually confirms success and returns the new account balance
• The ATM dispenses cash and asks the user to take it• The ATM asks whether the user wants to continue, the user indicates no• The ATM prints a receipt, ejects the card, and asks the user to take them• The ATM asks a user to insert a card
Class Diagrams
• Associations– Associations ends– Role names– Multiplicity– navigability
• Uni/Multidirectional
• Generalization
• Constrains
Personal Customer
creditCardNumber
Customer
nameaddress : String
credit() : String
Order
price : Moneydate
close()1*
Order Line
quantityprice
*
1
Product
1*
*
line items
1
Corporate Customer
creditNamecreditLimit
billForMonth()
Employee
1*
* 1
Aggregation / Composition
Polygon
Style
colorisFilled
1
n
Circle
radius
1
n
Point
3..n 13..n 1
{ordered}
n
1
n
1
Many to many associations and link
Line
name
Point
name2..n
intersects
2..n
L1 : Line P1 : Point
L2 : Line
L5 : Line
L3 : Line
L4 : Line
P2 : Point
Association Class
Employment
period : DateRange
Person Company
0..1nn 0..1
employer
Employment
period : DateRangePerson 0..1 Company1n
0..1n
/emploer
n 0..1
1 0..1 1n
Interfaces and Abstract Classes
• Generalization
• Realization
• Dependency
InputStream
DataInputStream
DataInput
OrderReaderInputStream
DataInputStream
DataInput
OrderReader
Derived Associations and Attributes
Summary Account Detailed Account
Account
/ balance : Moneyn
0..1
Entry
amount : Money
1
0..1
n
/entries
1
Sequence DiagramanOrderEntry
WindowanOrderEntry
WindowanOrderanOrder anOrderLineanOrderLine aStockItemaStockItem
aReorderItemaReorderItem
aDeliveryItemaDeliveryItem
1: prepare()
2: * prepare
3: hasStock = check()
4: [has stock] remove()5: needsReorder = checkReorder()
6: [needsReorder] new
7:
8: [hasStock] new
Collaboration Diagram
anOrderLine
anOrderEntry Window
anOrder
aStockItem
aReorderItem
aDeliveryItem
1: prepare()
2: * prepare
3: hasStock = check()4: [has stock] remove()
5: needsReorder = checkReorder()
6: [needsReorder] new
7:
8: [hasStock] new
State Diagram
[ Not all items checked ] / get next item
Checking
do/ checkItem
Dispatching
do/ initiate delivery
Waiting
Delivered
Delivered
Item Recieved[ all items available ]
[ all items checked && some item not in stock ]
[ all items checked && some items available ]
/ get first item
Item Recieved[ some items not in stock ]
State Diagram
Canceled
Checking
do/ checkItem
Dispatching
do/ initiate delivery
Waiting
Delivered
Delivered
Item Recieved[ all items available ]
[ all items checked && some item not in stock ]
[ all items checked && some items available ]
[ Not all items checked ] / get next item
/ get first item
Item Recieved[ some items not in stock ]
canceled
canceledcanceled
Super State
Active
Waiting
Checking
Waiting
Item Recieved[ some items not in stock ]
Dispatching
Item Recieved[ all items available ]
Delivered
Delivered
Canceled
Checking
canceled
Activity Diagram
Recieve Order
Fill Order
Send Invoice
Overnight Delivery
Regular Delivery
Recieve Payment
Close Order
[ rush order ] [ else ]
Composite Activity
Delivery
Regular Delivery
Overnight Delivery
Recieve Order
Fill Order
Send Invoice
Recieve Payment
Close Order
Regular Delivery
Overnight Delivery
[ else ][ rush order ]
Swimlanes
Fill Order
Delivery
Regular Delivery
Overnight Delivery
Regular Delivery
[ else ]
Overnight Delivery
[ rush order ]
Recieve Order
Send Invoice
Close Order
Recieve Payment
FinanceCustomer Serv iceFulfillment
ATM scenariofrom Object-Oriented Modeling and Design, by J.Rumbaugh, 1991
• The ATM asks the user to insert a card• The ATM accepts the card and reads its serial number• The ATM requests the password• The ATM verifies the serial number and password with the consortium, the
consortium checks it with the bank and notifies the ATM of acceptance• The ATM asks the user to select the kind of transaction (withdrawal, deposit, …).
The user select withdrawal• The ATM asks for the amount of cash• The ATM verifies that the amount is within predefined policy limits and asks the
consortium to process the transaction. The consortium passes the request to the bank, which eventually confirms success and returns the new account balance
• The ATM dispenses cash and asks the user to take it• The ATM asks whether the user wants to continue, the user indicates no• The ATM prints a receipt, ejects the card, and asks the user to takes them• The ATM asks a user to insert a card
ATM Sequence diagram
: NewClass4 : NewClass4
ATMATM ConsortiumConsortium BankBank
1: accept serial number and a password
2: verify account
3: verify account
4: enter operation kind and amount
5: process transaction
6: process bank transaction
7: OK
8: OK
11: terminate
12: print receipt
13: requset to take a card
14: give the card
15: eject the card
16: display main screen
9: requests take cash and continuation
10: take cach
Exercises
Spain : Country France : Country Belgium : CountryBorders Borders
P1 : Point
P2 : Point
P3 : Point
P4 : Point
: Polygon
has has
has has
Exercises
Grandmother : Person
Grandfather : Person
Your Father : Person
Aunt : Person
Your Mother : Person
cousin : Person
You : Person
Mate
child child
sibling Mate
child child child
cousin
Exercises
Variable
name
Constant
valueExpression
binary operator
Term
first operatorsecond operator
)X + Y/2) / (X/3 + Y(
Categorize relationships
1. A country has a capital city
2. A person use a fork
3. A file is an ordinary file or a directory file
4. Files contains records
5. A polygon is composed of ordered set of points
6. A drawing object is text, a geometrical object or a group
7. A person use computer language on a project
8. Modem and keyboard are input / output devices
9. A person plays in a team in certain year
10. A rout connects two cities
11. A studen takes a course from a professor
State diagram
1. Caller lifts receiver
2. Dial tons begins
3. Caller dials digit (5)
4. Dial tons ends
5. Caller dials digit (5)
6. Caller dials digit (5)
7. Caller dials digit (1)
8. Caller dials digit (2)
9. Caller dials digit (3)
10. Caller dials digit (4)
11. Called phone beings ringing
12. Ringing tones appears in calling phone
13. Called party answers
14. Called phone stops ringing
15. Ringing phone disappears in calling phone
16. Phones are connected
17. Called party hangs-up
18. Phones are disconnected
19. Caller hangs-up
State DiagramIdle
Dial tone
Dialing
Connecting
Ringing
Connected
Disconnected
Busy tone
Fast busy tone
Time out
Recorded message
State DiagramIdle
Phone Line
Dial tone
Dialing
Connecting
do/ find connection
Ringing
do/ ring bell
Connected
Disconnected
Busy tone
do/ slow busy tone
Fast busy tone
do/ fast busy tone
Time out
do/ soun loud beep
Recordered message
do/ play message
Dial tone
off-hook
Dialing
digit( n )
Connecting
do/ find connection
valid number
Ringing
do/ ring bell
routed
Connected
called phone answers
Disconnected
called phone hangs-up
Busy tone
do/ slow busy tone
Fast busy tone
do/ fast busy tone
Time out
do/ soun loud beep
Recordered message
do/ play message
time-out
time-out
invalid number
message done
on-hook
number busy
trunk busy