Title: ObjectOriented Programming Using Unified Modeling Language
1Object-Oriented Programming Using Unified
Modeling Language
- Shyh-Kang Jeng
- Department of Electrical Engineering/
- Graduate Institute of Communication Engineering
- National Taiwan University
2Reference
- G. Booch, J. Rumbaugh, and I. Jacobson, The
Unified Modeling Language User Guide, Addison
Wesley, 1999.
3Brief History of UML
- Object-oriented modeling languages (1970s-1980s)
- Object-oriented methods (1984-1994)
- Boochs method (expressive)
- Jacobsons OOSE (use cases)
- Rumbaughs OMT (useful for data-intensve systems)
- Three Amogos and Rational Software Corporation
- UML (1994) and OMG standard (v1.3, 1998)
4Use Case Diagrams
5Flow of Events
- Example ATM Validate User
- Main flow of events
- Exceptional flow of events
- Customer cancel a transaction
- Customer clear a PIN number
- Customer enters an invalid PIN number
6Scenarios
- A use case describes a set of sequences in which
each sequence in the set represents one possible
flow through all these variations. - Each sequence is called a scenario.
- A scenario is a specific sequence of actions that
illustrates behavior.
7Association Name, Role, Multiplicity
1..
Works for
Company
Person
employee
employer
8Association Aggregation
Company
1
Department
9Modeling Structural Relationships
10Responsibilities
FraudAgent
Responsibility -- determine the risk of a
customer order -- handle customer- specific
criteria for fraud
11Visibility
12Dependency
13Notes
14Modeling Different Views of a System
- Use case view
- Use case diagrams (structural modeling)
- Activity diagrams (behavioral modeling)
- Design view
- Class diagrams (structural modeling)
- Interaction diagrams (behavioral modeling)
- Statechart diagrams (behavioral modeling)
15Interaction Diagrams
16Instances
17Messages
18Sequence Diagrams
19Collaboration Diagrams
20Statechart Diagrams
21Case Study
22Use case diagram
Simulate Operation
23Use case description
- The user starts by entering the fabrication
mode of every machine and execution time. The
system then simulates the production line for the
entered execution time. After that the system
reports the sizes of all queues. The user
decides to quit or continue. If continue, the
user enters the fabrication modes and execution
time again, and the system repeats. The system
stops when the user decides to quit.
24Initial Class Diagram
ProductionLine
5
2
Queue
Machine
4
Connects to
2 input queues 2 output queues
25Statechart Diagram for Machine
26Statechart Diagram for Machine Modes
Input Queue is Empty
27Collaboration Diagram
1decrease
4increase
3decrease
2increase
2increase
4increase
3decrease
1decrease
28Flow-of-Events Description
- First, machine m1 responds according to the
statechart diagrams related to its fabrication
mode and state. If in Idle state and the input
queue is not empty, decrease the input queue (1).
If in InProduction state and the In Production
Hour reaches the Required Work Hours, increase
the output queue (2). Similarly, machine m2
responds according to the statechart diagrams
related to its fabrication mode and state (3,4).
29Initial Class Design -- ProductionLine
ProductionLine
Responsibilities -- simulate one hour -- set
fabricate modes -- add raw material
30Initial Class Design Queue
Queue
size int