1 July 1998 Rev 1.0 Introduction to UML Introduction to UML A Practical Approach to Product Development July 1998 Introduction to UML Slide 2 Description t This seminar is designed to help you get started using the Unified Modeling Language (UML) as a visual design tool using a development process. t A simple case study is presented to demonstrate domain modeling and design techniques as an integrated method. t Familiarity with object technology will enhance the attendee’s understanding of the models, but is not required.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1July 1998 Rev 1.0 Introduction to UML
Introduction to UML
A Practical Approach to Product Development
July 1998 Introduction to UML Slide 2
Description
t This seminar is designed to help you get startedusing the Unified Modeling Language (UML) as avisual design tool using a development process.
t A simple case study is presented to demonstratedomain modeling and design techniques as anintegrated method.
t Familiarity with object technology will enhance theattendee’s understanding of the models, but is notrequired.
1. The Answering System shall provide the capability for an owner to review acaller message. (Req-2, Review Caller Messages)â The IODevices Package shall provide the capability to play audio to a speaker.
(Pkg-4)
â The Messages Package shall provide the capabiliy to play caller messages to anoutput device. (Pkg-10)
2. The Answering System shall output the date and time of the caller messageto the owner on playback. (Req-11, Review Caller Messages)â The Foundation Package shall provide the capability to obtain the time of day.
(Pkg-1)
â The Messages Package shall timestamp caller messages with the time of the call.(Pkg-13)
â The Messages Package shall play the time of day when a caller message isplayed. (Pkg-19)
25July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 49
Package Requirements Example (2)
3. The Answering System shall output the identity of the caller of the callermessage to the owner on playback. (Req-12, Review Caller Messages)â The IODevices Package shall provide the capability to obtain the identity of the
caller. (Pkg-8)
â The Messages Package shall record the identity of the caller. (Pkg-14)â The Messages Package shall output the identity of the caller when a caller
message is played. (Pkg-20)
4. The Answering System shall provide the capability for an owner to reviewnew caller messages only. (Req-14, Review Caller Messages)â The Messages Package shall provide the capability for an owner to review new
caller messages only, (Pkg-17)
July 1998 Introduction to UML Slide 50
Package Development
t Class Design (per customer build)â Identify internal design classes and their
interfaces
â Define Method Traces
â ResultsF Documented in SDDF Presented at CDR
t Class Implementation(per internal build)â Implement classes
â Unit & Integration Testing
t Package Integrationâ Software Integration Testing (SWIT)
Caller Messages are recorded from the caller withassociated information. The caller messagesare flagged as new until the owner reviews themand are only deleted upon specific request.
July 1998 Introduction to UML Slide 64
Adding Class Properties
t Attributesâ Describing data properties
of a class
t Operations (Behaviors)â Describing localized
behavior of a class
CallerMessage
DateTimeCallerReviewedMessage
Record( )Play( )Delete( )Stop( )
33July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 65
Property Descriptions
Class: CallerMessage
t AttributesâDateTime - The caller message is recorded with the
date/time at the start of the call.
t Behaviors (Operations)âRecord() - Caller messages are recorded from the
phone line and are terminated when the caller hangsup, the maximum message length has been reached,or the owner terminates the recording. Emptymessages will be ignored.
July 1998 Introduction to UML Slide 66
Adding Relationships
Shown as an attribute Shown as an Association
AnsweringMachine
Greeting
AnswerMode
1
1
2
1
2
1
1
1
Answer Modes
AnsweringMachine
Answer Modes [2]
Greeting
AnswerMode
34July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 67
Associations
t Name (optional)further describes association
between members
t Rolesrole played by associated memberâ namedâ unnamed
t Multiplicityquantity of associated memberâ unspecifiedâ 1 - mandatoryâ 0..1 - optionalâ 0..* (or *) - manyâ # - specified value or range
AnsweringMachine
Greeting
Answer Mode
AnswerMode
1
1
2
1
2
1
1
1
Answer Modes
actions are controlled by
July 1998 Introduction to UML Slide 68
Reading Associations
An AnsweringMachine has “2”modes
The related AnswerModes play the roleof the AnsweringMachine’s “AnswerModes”
An Answer Mode isassociated with “1”Answering Machine
The Greeting plays therole of a “Greeting”
There is “1” Greetingper Answer Mode
A Greeting isassociated with “1”Answer Mode
AnsweringMachine
Greeting
Answer Mode
AnswerMode
1
1
2
1
2
1
1
1
Answer Modes
actions are controlled by
Answering Machine“actions are controlledby” Answer Modes
35July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 69
Adding Properties to Associations
Person
NameSSN
Company
Name0..*0..*0..* 0..*
Employment
Employment
Hire DateTermination DateSalary
Person
NameSSN
Company
Name0..*0..*0..* 0..*
Use Attributed Class to addproperties unique to theassociation between two classes
Use named/unnamed associations where there areno properties unique to the association betweentwo classes
July 1998 Introduction to UML Slide 70
Adding Constraints on Associations
Person
CallerMessage
Organization
{or}
The caller willbe identified aseither a personor anorganization
36July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 71
Adding Aggregation to Associations
CallerMessage
Mailbox
0..*
1
0..*
1
CallerMessage
Mailbox
0..*
1
0..*
1
t Aggregation (open diamond)â shows side of association that
represents the aggregate
t Composite (filled in diamond)â A refinement of aggregation
showing the aggregate havingownership of the member
Aggregation
Composite
July 1998 Introduction to UML Slide 72
Adding Uses Dependency Association
t Uses Relationshipdependency shown with
<<uses>> stereotypeâ shows a usage relationship
between associated classes
â the association is temporary(created and forgotten duringthe completion of a behavior)
InputDevice
OutputDevice
CallerMessage
<<uses>>
<<uses>>
t Dependency Relationshipshown by dashed directed
arrow
37July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 73
Association Descriptions
Class: CallerMessaget Associations:
âMailbox [1] - Caller messages are assigned to aparticular mailbox.
Class: Mailboxt Associations:
âCallerMessage [0..*] - A mailbox contains all callermessages until they are deleted.
tUses:âOutputDevice - Caller Messages are played to the
specified output device.
July 1998 Introduction to UML Slide 74
Inheritance
t Indicates type/sub-typeâ derived classes (sub-type)
comply with base class(type) interface definitions
t Indicates class/sub-classâ derived classes (sub-class)
reuse or extend base class(class) implementation
Microphone
Listen( )
Speaker
Play( )
PhoneLine
RingCount
Hangup( )Answer( )Listen( )Play( )
InputDevice
Listen( )
OutputDevice
Play( )
38July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 75
Reading Inheritance
Microphone
Listen( )
Speaker
Play( )
PhoneLine
RingCount
Hangup( )Answer( )Listen( )Play( )
InputDevice
Listen( )
OutputDevice
Play( )
InputDevice isthe base class ofMicrophone andPhoneLine
tRepresents the functionality of the system (orclass) as seen by the external user
42July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 83
Use Case Diagram Elements
t Use Caseshown by oval with name inside or
below oval - may also containcompartment for extension points
â unit of useful functionalityprovided by system
â sequence of actions
External Owner External Caller
Review CallerMessage
Take Caller Message
t Actorshown by a stick figure with name
â role of an object or objectsexternal to the system
â one object may play manyroles
Answer Caller
extension pointsmode-specific processing
July 1998 Introduction to UML Slide 84
Use Case Specification
Use Case: Answer CallerThis use case begins with a caller ringing the answering machine and completes after
the call has been completed. This use case is meant to be extended by modespecific processing.
t Pre-conditions:â Answering machine is idle
t Post-conditions:â Greeting is played to callerâ Mode-specific processing is performed
t Primary Path (Caller Listens to Greeting):â 1.The caller rings the phone line connected to the answering machine.â 2.The system waits for the ring count to reach the answering ring count.â 3.The system plays a greeting.â 4.The system performs any mode-specific processing
t Alternate Path (Caller Hangs Up During Greeting):â The caller hangs up during the playing of the greeting. The system recognizes
the hang-up, stops the greeting and prepares for the next caller.
43July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 85
Adding Use Case Relationships
Answer Caller
Take Caller MessagePlay Greeting
External Caller
<<extends>>
<<uses>>
Uses
Extends
Communicates
July 1998 Introduction to UML Slide 86
Adding Use Case Relationships
Answer Caller
Take Caller MessagePlay Greeting
External Caller
<<extends>>
<<uses>>
Communicates• participation of anactor in a use case• the onlyrelationship betweenan actor and a usecase
Uses• specifies that theusing use case willalso include behaviorof the use use case
Extends• the extended usecase may containbehavior specified byextending use case
44July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 87
Communicates Relationship
t Participation of an actorin a use case
t This is the onlyrelationship betweenactors and use cases
Answer Caller External Caller
Participates in
Actor:External Caller
Use Case:Answer Caller
July 1998 Introduction to UML Slide 88
Uses Relationship
t Specifies that the usinguse case will also includebehavior of the used usecase
Answer Caller
Play Greeting
External Caller
<<uses>>
Used Use Case: Play Greeting
Using Use Case: Answer Caller
includes the same behavior specified in
45July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 89
Extends Use Case
t The extended use casemay contain behaviorspecified by extendinguse case
Answer Caller
Take Caller Message
External Caller
<<extends>>
Extended Use Case: Answer Caller
may contain the behavior specified by
Extending Use Case: Tale Caller Message
July 1998 Introduction to UML Slide 90
Specifying Use Case Relationships
Use Case: Answer Caller
t Actor:âExternal Caller
tUses:âPlay Greeting
t Extension PointsâMode-specific process will be performed after
greeting is complete.
46July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 91
Example: Answering Machine Use Diagram
Answer Caller
External Caller
Take Caller Message
<<extends>>
Review Caller Message
Set Answer Mode
Delete Caller Message
<<uses>>
Record Greeting
Play Greeting
<<uses>>External Owner
<<uses>>
Activity Diagrams
47July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 93
Activity Diagram Overview
tRepresents the state of a procedureâEach state represents a step in the procedure
âThe exit event from the state is the completion of theprocedure
t Shows a workflow ofâUse Cases (Requirements Definition)
âOperations (Package Specification)
tCan show concurrency
July 1998 Introduction to UML Slide 94
Answer Phone Line
Play Greeting
UpdateIndicator
Play toOutput Device
Record Caller Message
[Message]
[No Message]
Answering System Example
[Call Stopped]
Take CallerMessage
48July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 95
Activity Diagram Symbols
Synchronization Bar
GuardDecision Activity
Answer Phone Line
Play Greeting
UpdateIndicator
Play toOutput Device
Record Caller Message
[Message]
[No Message]
ActivityInitial State
End State
State Transition
SynchronizationCondition
[Call Stopped]
July 1998 Introduction to UML Slide 96
Review Messages
Multiple Triggers
Play Message
* Multiple Trigger
49July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 97
Object Flows
Answer Phone Line
Play Greeting
UpdateIndicator
Play toOutput Device
Record Caller Message
[Message]
[No Message]
Message[new]
Object
[Call Stopped]
July 1998 Introduction to UML Slide 98
Swim Lanes
Answer Phone Line
Play Greeting
UpdateIndicator
Play toOutput Device
Record Caller Message
[Message] [No Message]
Answering System Messages IO Devices
[Call Stopped]
50July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 99
Architecture Design: Results
tClass Models
tMethod Tracest Event Traces
t State Models
tComponent Models
tDeployment Models
Class Design Models
Specification andImplementation Levels
51July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 101
Class Design Model Overview
t SpecificationâDefine interfaces to software implementing the
domain class model
t ImplementationâShows where and how implementations are
performed
July 1998 Introduction to UML Slide 102
Packages
t Begin to identifyclasses that define theinterface and thepublic/non-publicclasses that implementthose interfaces
Plays the vector of audio samples to the modem. Will throw aNotReady exception if the modem is not ready or a Hangupexception if the line is hung-up during the play.
54July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 107
Refining Relationships
Message
<<interface>>OutputDevice
play (audio : Audio) : void
PhoneLineImpl
deviceAddress : long
play (audio : Audio) : voidhangup () : void
Message
OututDevice
PhoneLineImpl
deviceAddress : long
play (audio : Audio) : voidhangup () : void
MessagePhoneLineImpl
deviceAddress : long
play (audio : Audio) : voidhangup () : void
t Implementations will beput together at run-time
t Using implementationswill be coupled to a sub-set (interface) of the usedimplementation’scapabilities
t UML offers a shorthandinterface notation
Interaction Diagrams
Sequence andCollaboration Diagrams
55July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 109
Interaction Diagram Overview
t Shows interaction between objectst Varying levels of detail
âEvents (Event Trace*)âMethods (Method Trace*)
t Sequence DiagramâVisually arranged in time-order of messagesâShows lifeline of objects
tCollaboration DiagramâVisually arranged around objectsâShows object relationships
Visibility Specification<<global>> - global (global to related object)<<field>> - attribute of related object)<<parameter>> - passed as temporary to related object<<local>> - created within method of related object
t Shows sequence of states an object goesthrough in response to a stimuli
t Shows actions and activities performed andevents issued
t Allows identification of missingâAttributes - to remember states
âBehaviors - to receive events
61July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 121
Caller Message Example
Recording
entry: set date/timeentry: set caller id
do: ^InputDevice.Listen
New
Hangup[ Message not empty ]
Reviewed
Playing
do: ^OutputDevice.Play
Idle
DeletedHangup[ Message empty ]
Play / set reviewed = true
Playing
do: ^OutputDevice.Play
Idle
PlayComplete
Delete
Record
July 1998 Introduction to UML Slide 122
State Diagram Elements
Recording
entry: set date/timeentry: set caller id
do: ^InputDevice.Listen
Hangup[ Message not empty ]
Hangup[ Message empty ]Record
StateEvent
Start
Guard Condition
Action
Activity
Event
Transition
End
62July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 123
Key Diagram Elements
t TransitionâEvent arg-list [ guard condition ] / action expression
t Action - atomic, non-interruptibleâentry / expression
âexit / expression
âSend ActionF^Target Object.Message(arguments)
t Activity - on-goingâdo / expression
July 1998 Introduction to UML Slide 124
Transition/Entry Actions
New Reviewed
entry: ^OutputDevice.Play
Play / set reviewed = true
Play
An Action taken on Play from New State
Self-Transition
An Action taken no matter how state entered
63July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 125
Composite States
Hangup[ Message not empty ]
Reviewed
Playing
do: ^OutputDevice.Play
Idle
DeletedHangup[ Message empty ]
Play / set reviewed = true
Playing
do: ^OutputDevice.Play
Idle
PlayComplete
Delete
July 1998 Introduction to UML Slide 126
Concurrent States
Taking Message
Recording
Playing to Output Device
Recording
Playing to Output Device
64July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 127
Updating Class Model
Recording
entry: set date/timeentry: set caller id
do: ^InputDevice.Listen
New
Hangup[ Message not empty ]
Reviewed
Playing
do: ^OutputDevice.Play
Idle
DeletedHangup[ Message empty ]
Play / set reviewed = true
Playing
do: ^OutputDevice.Play
Idle
PlayComplete
Delete
Record
CallerMessage
CallerReviewedDateTime
Record( )Play( )Delete( )
Deployment Diagrams
65July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 129
Deployment Diagram Overview
t Shows mapping of software components tohardwareânode - a computer
âconnection - a link between nodes
âcomponents - physical modules of code
âdependencies - show communication betweencomponents
July 1998 Introduction to UML Slide 130
Deployment Diagram
Messages
AnsweringSystem
IODevices
Node Dependency
Workstation
PhoneCompany
Connection
Components
66July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 131
Refining Dependencies into Interfaces
AnsweringSystem
MessagesIODevices
InputDevice
OutputDevice
PhoneLine
Greeting
CallerMessage
MailboxInterface
July 1998 Introduction to UML Slide 132
UML and Design Patterns
tUse patterns to describe the key ideas in thesystem
tDocument the designs that have beendiscarded; sometimes it is just as important toknow why certain patterns/ideas are not beingused
tUse UML to capture the pattern’s context forsolving this domain problem
67July 1998 Rev 1.0 Introduction to UML
July 1998 Introduction to UML Slide 133
Modeling and UML
tWhat makes a good model?
tWhen to apply UMLtHow to apply UML
July 1998 Introduction to UML Slide 134
Summary
t UML is a modeling language that can be used totallyindependent of the development process
t UML has been adopted by the OMG and is quicklybecoming the notation of choice for visual modeling
t UML Resourcesâ http://uml.systemhouse.mci.com (OMG UML info)â http://www.awl.com/cp/awweb.htm (survey of analysis and design methods)â http://st-www.cs.uiuc.edu/users/patterns/patterns.html,
http://c2.com/ppr/index.html (Patterns info)â http://www.rational.com/uml/documentation.html (Rational doc)â http://www.rational.com/products/rose/seed (Rational CASE tools)