introduction to uml - computer and information...

67
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.

Upload: tranphuc

Post on 18-Mar-2018

221 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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.

Page 2: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

2July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 3

Speakers

t Jim Staffordâ DoD Contracting

F OO Mentoring

F UCA Framework SystemEngineering

F Distributed ComputingInfrastructure

â RABA Technologies, Inc

â http://www.raba.com/~jcstaff

â JHU/APL OOP/C++ Instructor

â [email protected]

t Michele Mooreâ DoD Contracting

F OO Mentoring

F Software Development

â RABA Technologies, Inc

â JHU/SCS OOP, C++, Javainstructor

â [email protected]

July 1998 Introduction to UML Slide 4

Objectives

t Introduce UML in the context of a practicalobject-oriented work process

t Introduce a proven object-oriented process

tUnderstand how UML models fit into theprocess

tDiscover how to create UML models

Page 3: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

3July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 5

Agenda

t (Day 1) Process and UML: IntroductionâUML Background

âGetting Started with Object Modeling

âModeling At A Glance with UML

âProcess Overview

t (Day 2) Process and UML: InsertionâProcess and UML Applied

âCase Study: Answering MachineâOther Resources

July 1998 Introduction to UML Slide 6

UML Background

tHistory of UML

t The “Methodology Wars”tWhat UML is

tWhat UML is not

Page 4: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

4July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 7

History of UML

t Design methods popularized in 70’s & 80’s

t Technical community inundated with models, methodologies,notations by early 90’s

t Standardization was needed, but no one was willing to champion thecause and make it successful; many were opposed to the idea

t OOPSLA ‘94 Grady Booch and James Rumbaugh announced themerging of their methods

t OOPSLA ‘95 revealed the first public description of the UnifiedMethod, with Ivar Jacobson joining the duo

t During 1996, the “Three Amigos” worked on the new method,renaming it as the Unified Modeling Language (UML)

t In January ‘97, UML was proposed to OMG as a standard to facilitatethe interchange of models; UML 1.1 adopted by OMG in Nov ‘97

July 1998 Introduction to UML Slide 8

Methodology Wars of the 90’s

Booch Method - BoochRational

OMT - Rumbaugh, Blaha, Premerlani, Eddy, LorensenGE ACC

OOSE - JacobsonObjectory

Coad/Yourdon - CoadObject International

...Others...

Page 5: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

5July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 9

Methodologist Terminology

UML Class Association Generalization Aggregation

Booch Class Uses Inherits Containing

Coad Class &Object

InstanceConnection

Gen-Spec Part-Whole

Jacobson Object AcquaintanceAssociation

Inherits Consists of

Odell ObjectType

Relationship Subtype Composition

Rumbaugh Class Association Generalization Aggregation

Shlaer/Mellor

Object Relationship Subtype N/A

July 1998 Introduction to UML Slide 10

1995 Unified Method from Rational

Unified Method - Booch, RumbaughRational

OOSE - JacobsonObjectory

Coad/Yourdon - CoadObject International

...Others...

Page 6: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

6July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 11

January 1997 UML from Rational

Unified Modeling LanguageObjectory Process - Booch, Rumbaugh

Rational

JacobsonObjectory

Coad/Yourdon - CoadObject International

...Others...

UML v1.0OMG

July 1998 Introduction to UML Slide 12

November 1997 UML from OMG

Objectory Process - Booch, Rumbaugh, Jacobson

Rational

Coad/Yourdon - CoadObject International

...Others...

UML v1.1(v1.2 in draft)

OMG

Page 7: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

7July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 13

What UML Is

tUML is a modeling language, a notation used toexpress and document designs

tUML unifies the notation of Booch, Rumbaugh(OMT) and Jacobson, and augmented withother contributors once submitted to OMG

tUML proposes a standard for technicalexchange of models and designs

tUML also defines a “meta-model”, a diagramthat defines the syntax of the UML notation

July 1998 Introduction to UML Slide 14

What UML Is Not

tUML is not a method or methodology(Method = Notation (e.g.,UML) + Process)

tUML does not dictate a particular process(although the “Rational Objectory Process” is beingproposed by Booch, Rumbaugh and Jacobson)

tUML can be used to record the resulting domainand design models, independent of the process

tChoose an appropriate process for a particularproject, independent of the modeling language

Page 8: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

8July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 15

Why Use UML

t Standardized notation without sacrificingspecialized model data

tCommon language that can be used fromproduct conception to delivery, from system todetailed design levels

tReduced learning curve across projects

t Increased domain and design model reuse

t Increased customer involvement /understandingof problem translation to product solution

July 1998 Introduction to UML Slide 16

Where to Start?

t Identify key domain abstractions … classes integrating:â Attributes

â Behavior (responsibilities, methods)

â MessagingF providing logical independence between client and object

â PolymorphismF providing physical independence between client and implementation

t Consider relationships … integrating classes and objects to formhigher levels of abstractionâ Association (“Uses, Needs”)

â Aggregation (“Has-A”)

â Inheritance (“Is-A”)

t Begin constructing your models

Page 9: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

9July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 17

Model Perspectives

tConceptualFBook [Title]

âobjects, “things” from the domain

âconceptual map to implementation

t SpecificationFBookIface { void setTitle(String value); }

âidentifies how to obtain properties

t ImplementationFPersistentBook : BookIface { -> DB }

âidentifies how interface will be implemented

July 1998 Introduction to UML Slide 18

Initial Modeling Results

t List of use cases, describing systemrequirements

tDomain model, capturing your understanding ofthe business process and key domain classes

tDesign model, realizing both the information inthe domain objects and the behavior describedin the use cases

t Add classes in the design model that actuallydo the work and also provide a reusablearchitecture for future extensions

Page 10: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

10July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 19

UML Notation Baseline

tUse Case Diagrams

tClass Diagramst Package Diagrams

t Activity Diagrams

t State-Transition Diagrams

t Event Trace (Interaction) DiagramsâSequence Diagrams

âCollaboration Diagrams

tDeployment Diagrams

July 1998 Introduction to UML Slide 20

Use Case Diagrams

t Show the external actors andtheir connection to thefunctionality (use cases) of thesystem

t Use cases provide the basis ofcommunication betweensponsors/customers andimplementers in the planningof a projectâ Capture some user-visible

function

â May be small or largeâ Achieves a discrete goal for the

user

Student

Billing System

Register for Courses

Page 11: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

11July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 21

Class Diagrams

t Show the static structure ofthe domain abstractions(classes) of the system

t Describe the types of objectsin the system and thevarious kinds of staticrelationships that existamong themâ Associations

â Derivations

t Show the attributes andoperations of a class andthe constraints for theway objects collaborate

StudentInfo

major

ProfessorInfo

tenureStatus

StudentSchedule

dateUpdated : char*semester : char*

change( )

1

1

NewCourseForm

(from Interfaces)

1

Curriculum

1..*

Course

newCourse( )getInfo( )

1

1

creates

1

1..*

RegistrationUser

nameIDNumber

July 1998 Introduction to UML Slide 22

Package Diagrams

t Shows the breakdown oflarger systems into a logicalgrouping of smallersubsystems (e.g,Coad/Yourdon’s SubjectLayer)

t Shows groupings of classesand the dependencies amongthem

t A dependency exists betweentwo elements if changes to thedefinition of one element maycause changes to the other

UniversityArtifacts

Interfaces

Database

global

Page 12: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

12July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 23

Activity Diagrams

t Show the sequential flow ofactivitiesâ typically in an operation

â also in a use case or event trace

t Complement the class diagramby showing the workflow of thebusiness (aka “Flowchart”)

t Encourage discovery of parallelprocesses which helps eliminateunnecessary sequences inbusiness processes

Select Courses

Confirm Availability

for eachchosen course

Buy Book Attend Class

July 1998 Introduction to UML Slide 24

State-Transition Diagrams

t Show all the possible statesthat objects of the class canhave and which events causethem to change

t Show how the object’s statechanges as a result of eventsthat are handled by the object

t Good to use when a class hascomplex lifecycle behavior

Selecting

select a course

Confirming

select a course

courseselected

course notavailable

Registering

Register studentfor courses

all coursesconfirmed

Completed

registrationdb updated

Page 13: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

13July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 25

Interaction (Event Trace) Diagrams (1)

Sequence Diagramst Show the dynamic

collaboration between objectsfor a sequence of messagessent between them in asequence of time

t Time sequence is easier tosee in the sequence diagram,read from top to bottom

t Choose sequence diagramwhen only the sequence ofoperations needs to be shown

: Registrarcourse form :

NewCourseFormSales 101 :

Course : Transaction

Manager : DBCourse

ope

set info

submit for processingnewCourse ( )

course

saveCourse ( saveCourse (

getInfo (

Create a course

July 1998 Introduction to UML Slide 26

Interaction (Event Trace) Diagrams (2)

Collaboration Diagramst Show the actual objects and

their links, the “network ofobjects” that are collaborating

t Time sequence is shown bynumbering the message labelof the links between objects

t Choose collaboration diagramwhen the objects and theirlinks facilitate understandingthe interaction, and sequenceof time is not as important

Create a course:Registrar

courseForm:NewCourseForm

Sales101:Course :TransactionMgr

1: open()

4: newCourse()

2: setInfo()3: submit()

5: saveCourse()

: CourseDB

6: saveCourse()

7: getInfo()

8: courseCreated()

Page 14: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

14July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 27

Deployment Models

t Show the physical architectureof the hardware and softwareof the system

t Highlight the physicalrelationships among softwareand hardware components inthe delivered system

t Components on the diagramtypically represent physicalmodules of code andcorrespond exactly to thepackages on a packagediagram

Registration System

Database

Dorm Main Building

Library

July 1998 Introduction to UML Slide 28

Process Overview

tConceptualization

tRequirements Definitiont Architecture Design

t Package Development

tDelivery

tMaintenance

Page 15: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

15July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 29

Conceptualization(entire system)

tDefine Purpose and Prioritized Features

t “Sketch” Early Domain Class Modelt Identify Use Cases and Primary Paths

t Identify Schedule, Risks, Resources

July 1998 Introduction to UML Slide 30

Domain Class Model Example

1

1

PhoneLine

1

0..*

CallerMessage

2

GreetingAnswer Mode

1

AnsweringMachine

1

1

1

0..*2

1

Page 16: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

16July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 31

Use Case Identification Using Activity Diagrams

Answer Phone Line

Play Greeting

UpdateIndicator

Play toOutput Device

Record Caller Message

[Message]

[No Message]

[Call Stopped]

Take CallerMessage

July 1998 Introduction to UML Slide 32

Use Case Identification Example

t Actors: External Caller, External Owner

tUse Case: Answer CallertUse Case: Review Caller Message

tUse Case: Record Greeting

tUse Case: Set Answer Model

tUse Case: Take Caller Message

tUse Case: Play Greeting

tUse Case: Delete Caller Message

Page 17: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

17July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 33

Conceptualization Applied

tConsider a University Student RegistrationSystemâIdentify 5 key abstractions, attributes, responsibilities,

relationships

(Eyes on your own paper! :)

July 1998 Introduction to UML Slide 34

Exercise Results

Page 18: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

18July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 35

Requirements Definition(per build OR entire system)

t Define Domain Class Model

t Describe Use Cases, Primary & Alternate Paths

t Map Requirements to Classes & Use Cases/Use CasePaths

Results• Documented in an Operational Concept Document (OCD) and

Software Requirements Spec (SRS)• Presented at Software Requirements Review (SRR)

FunctionalRequirement

DataRequirement

Use Case

Use Case Path

DomainClass

breaks down into one or more

helps id

helps id mapped to

mapped to

July 1998 Introduction to UML Slide 36

Domain Class Model Example

1

GreetingGreeting

Play( )

11

0..*

CallerMessageDateTimeCallerReviewedMessage

Record( )Play( )Delete( )

1

PhoneLineRingCount

Answer( )Play( )Listen( )Hangup( )

11

2AnswerModeAnswer Ring

1

11

MailboxTotal MessagesNew Message Count

1

0..*

1

1

Speaker

Play( )

1

AnsweringMachine

1

11

2

11

1

1

<<uses>>

<<uses>>

<<uses>>

<<uses>>

Page 19: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

19July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 37

Class Specification ExampleClass: CallerMessage

Messages are recorded from the caller with associated information.

The caller messages are flagged as new until the owner reviews them and are onlydeleted upon specific request.

Attributes:Date Time - The calls is recorded with the date/time at the start of the call.

Caller - The caller is identified by the phone company.Reviewed - Any caller message that has been played is considered reviewed.

Message - Caller message data must contain a message; empty messages aredeleted

Behavior:Record - Caller messages are recorded from the phone line and are terminated when

the caller hangs up, the maximum message length has been reached, or theowner terminates the recording. Empty messages will be ignored.

Play - Caller messages are played to the speaker for the owner to listen to.

Delete - The owner can delete specific messages.Stop - The play or recording of the caller messages can be stopped by the owner.

July 1998 Introduction to UML Slide 38

System Requirements Example

Caller Message1.The Answering System shall provide the capability for an owner to

review a caller message. (Req-2, Review Caller Messages)

2.The Answering System shall output the date and time of the callermessage to the owner on playback. (Req-11, Review Caller Messages)

3.The Answering System shall output the identity of the caller of the callermessage to the owner on playback. (Req-12, Review Caller Messages)

4.The Answering System shall provide the capability for an owner toreview new caller messages only. (Req-14, Review Caller Messages)

…etc.

Page 20: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

20July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 39

Requirements Definition Applied

t Identify 5 System Requirements for theUniversity Student Registration System

tDescribe them as specific use cases

July 1998 Introduction to UML Slide 40

Exercise Results

Page 21: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

21July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 41

Use Case Diagram at a Glance

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>>

July 1998 Introduction to UML Slide 42

Use Case Specification Example

Use Case: Answer Callert This use case begins with a caller ringing the

answering machine and completes after thecall has been completed. This use case ismeant to be extended by mode specificprocessing.

t Actors:â Caller

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 toGreeting):1. The caller rings the phone line

connected to the answering machine.

2. The system waits for the ring countto reach the answering ring count.

3. The system plays a greeting.4. The system performs any mode-

specific processing

t Alternate Path (Caller Hangs UpDuring Greeting):â The caller hangs up during the

playing of the greeting. The systemrecognizes the hang-up, stops thegreeting and prepares for the nextcaller.

Page 22: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

22July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 43

Architecture Design(entire system)

t Identify package boundaries and allocate primary responsibility ofdomain classes to a package

t Break complex use cases into uses relationships that fit withinidentified packages

t Identify interfaces for domain classes that cross packageboundaries

t Define event traces for key interactions between packages

t Resolve Strategic Issues

Results• Package interactions generated• Define risk-based build schedule• Documented in Software Design Description (SDD); presented at System PDR

Use Case Path

Event TraceConcrete Analysis

Scenario

DomainClass

ids

used to implement

ConcreteUse CaseScenario

July 1998 Introduction to UML Slide 44

Class Packages

AnsweringSystem

+ AnsweringMachine+ AnswerMode+ AnnounceMode+ MessageMode

IODevices

+ InputDevice+ OutputDevice+ PhoneLine+ Microphone+ Speaker

Messages

+ CallerMessage+ Mailbox+ Greeting

Foundation

+ Clock+ Observer

Page 23: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

23July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 45

Key Event Trace Example (1)

1. The caller rings the phone lineconnected to the phone line.

2. The phone line reports the event of anew call to the current answer mode.

3-4. The answer mode waits for theowner-specified.

5. The phone line is told to answer thecaller.

6-8. The answer mode plays the greeting.9. The specific answer mode will perform

any mode-specific processing

10. The phone line is hung up.

: External Caller : PhoneLine : AnswerMode : Greeting

1: Ring ( )

2: New Call ( )

3: Ring ( )4: New Call ( )

5: Answer ( )6: Play ( )

7: Play ( )

8: Greeting Complete

9: Answer Complete ( )

10: Hangup ( )

Answer Caller (Caller Listens to Greeting)

July 1998 Introduction to UML Slide 46

Use Case/Event Trace Text Comparison

Event Trace Script1. The caller rings the phone line

connected to the phone line.

2. The phone line reports the event of anew call to the current answer mode.

3-4. The answer mode waits for theowner-specified.

5. The phone line is told to answer thecaller.

6-8. The answer mode plays thegreeting.

9. The specific answer mode willperform any mode-specificprocessing

Use Case Script

1. The caller rings the phone lineconnected to the answeringmachine.

2. The system waits for the ringcount to reach the answeringring count.

3. The system plays a greeting.

4. The system performs any mode-specific processing

Page 24: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

24July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 47

Key Event Trace Example (2)

: External Caller : PhoneLine : MessageMode : Mailbox : Speaker : Message

Indicatormessage :

CallerMessage

3: Create (caller, timeOfCall)

2: CallerId ( )

4: Record (InputDevice)

5: Listen ( )

6: Play ( )

7: Disconnect ( )8: Caller Message Complete

9: Record (message)10: New Message ( )

1: Answer Complete ( )

Take Caller Message (Caller Leaves Message)

July 1998 Introduction to UML Slide 48

Package Requirements Example (1)

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)

Page 25: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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)

Event Trace

Concrete Analysis Scenario

Method Trace

Concrete Design Scenario

ClassDesign

ids details for

used to implement

tested by

tested by

Codeids context for

Page 26: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

26July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 51

Class Design Example

InputDevice

Listen( )Initialize( )Audio( )Terminate( )

speaker

0..1

OutputDevice

Play( )Initialize( )Terminate( )

PhoneLine

RingCount

Hangup( )Answer( )Listen( )Play( )Ring( )Disconnect( )CallerId( )Initialize( )

0..1

Observer

Notify( )

(from Foundation)

AudioSample

PhoneLineImpl

MicrophoneImpl SpeakerImpl

July 1998 Introduction to UML Slide 52

Method Trace Example

: External Caller

: PhoneLine

: AnsweringMachine

: MessageMode : CallerMessage

: Mailbox

G

1: Ring

F

F

2: notify ( int, void*)

F

F

3: newCall ( )5: CallerMessage (callerId , dateTime)

6: record (InputDevice&)

P

4: callerId ( )7: listen ( )

Audio

P

8: record (CallerMessage&)

F

F

P

PP

G F

F

F

F

F

F

L

Take Caller Message

Page 27: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

27July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 53

Delivery(per build)

t Integrate Changes

t System TestingtDevelop/Update User Documentation

t Field System

t Track Error Reports

tDeployment Diagrams

July 1998 Introduction to UML Slide 54

Maintenance

tCollect Change/Enhancement RequestsâPrioritize

âGroup

t Enter the Process Spiral Again

Page 28: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

28July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 55

Overall Process Mapping

FunctionalRequirement

DataRequirement Use Case

Use Case Path

Event TraceConcrete Analysis

Scenario

Method TraceConcrete Design

Scenario

DomainClass

ClassDesign

breaks down into one or more

helps id

helps id

ids

used to implement

ids details for

used to implement

tested by

tested byCode ids context for

mapped tomapped to

Concrete Use CaseScenario

tested by

July 1998 Introduction to UML Slide 56

Process Roles

t Requirements

t Use Cases

t Use Case Paths

t Domain Classes

t Event Traces

t Class Designs

t Message Traces

t Code

t Unit Test

t Integration Test

t Acceptance Testing

t Customer

t Customer Representative

t System Engineer

t Software Architect

t Subsystem Lead

t Developer

t Subsystem Lead

t System Engineer

Page 29: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

29July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 57

Session 2: Process Insertion

t Process Goals / ResultsâConceptualization

âRequirements Definition

âArchitecture Design

âPackage Development

âDelivery

âMaintenance

tUML In ActionâCase Study: Answering Machine System

July 1998 Introduction to UML Slide 58

Conceptualization/Requirements Definition Models

tDomain Class Model

tUse Case Modelst Activity Diagrams

tRequirements Management

Page 30: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

30July 1998 Rev 1.0 Introduction to UML

Class Models

Conceptual Level

July 1998 Introduction to UML Slide 60

Class Model Overview

t Shows static properties of a Class

tDepicted graphically in Class Diagrams andtextually in Class Specifications

tMay be organized into Packages

tClass DiagramsâShow an aspect of a set of Classes

âNeed not contain entire Package

âNeed not be restricted to Package boundaries

Page 31: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

31July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 61

Packages

AnsweringSystem

IODevices Messages

Messages

+ CallerMessage+ Mailbox+ Greeting

t Grouping of modelelements (including non-class models)

t Can be nested

t Lists classes (optional)contained within packageâ + Public Visibility

â -/# Non-public Visibility

July 1998 Introduction to UML Slide 62

Class Symbols

t Solid rectangle

t Three compartmentsâ Class Name and general

properties (optional)F Package (Package::)

F Stereotypes (<< >>)

F Constraints ({ } )

F Meta-model attributes

â Attributes (optional)

â Operations (optional)

t Additional compartmentsallowed

CallerMessage

Mailbox{ author=“bob” }

Greeting

<<controller>>AnsweringSystem::AnswerMode

IODevices::OutputDeviceresponsibilitiesOutput Audio

IODevices::InputDevice

AnsweringMachine{1}

Page 32: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

32July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 63

Class Descriptions

Class: CallerMessage

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( )

Page 33: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 34: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 35: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 36: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 37: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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( )

Page 38: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Microphone“is-a” type ofInputDevice

PhoneLine “is-a” typeof InputDevice andOutputDevice

July 1998 Introduction to UML Slide 76

Inheritance Descriptions

Class: OutputDevice

t Behaviors:âPlay() - Output devices can play audio.

Class: PhoneLine

t Inheritance:âOutputDevice, InputDevice

t Behaviors:âPlay() - Audio can be played to the phone line until

the caller or system hangs up.

Page 39: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

39July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 77

Example: Answering Machine Packages

AnsweringSystem

+ AnsweringMachine+ AnswerMode+ AnnounceMode+ MessageMode

IODevices

+ InputDevice+ OutputDevice+ PhoneLine+ Microphone+ Speaker

Messages

+ CallerMessage+ Mailbox+ Greeting

July 1998 Introduction to UML Slide 78

Example: IODevices Package

Microphone

Listen( )

Speaker

Play( )

PhoneLine

RingCount

Hangup( )Answer( )Listen( )Play( )

InputDevice

Listen( )

OutputDevice

Play( )

Page 40: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

40July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 79

Example: Messages Package

InputDevice

OutputDevice

0..*

CallerMessageDateTimeCallerReviewedMessage

Record( )Play( )Delete( )Stop( )

<<uses>>

<<uses>>

1

1

Mailbox

Total MessagesNew Message Count

Record( )Play( )

0..*

1

1

1

AnsweringMachine

11

2

1

Greeting

Answer ModeGreeting

Record( )Play( )Stop( )

<<uses>>

<<uses>>

1

AnswerMode

1

2

1

1

July 1998 Introduction to UML Slide 80

Example: Answering System Package

PhoneLineMessageMode

Max Message Length

New Call( )

AnnounceMode

1

Greeting

1

12

AnswerMode

Answer Ring

New Call( )

1

1

1

Mailbox1

1

1

1

1

Speaker

1

AnsweringMachine

12 1

1

1

1

1

1

1 Microphone

1

1

Page 41: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

41July 1998 Rev 1.0 Introduction to UML

Use Cases

Specifications andUse Case Diagrams

July 1998 Introduction to UML Slide 82

Use Case Overview

tRepresents the functionality of the system (orclass) as seen by the external user

Page 42: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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.

Page 43: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 44: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 45: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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.

Page 46: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 47: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 48: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 49: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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]

Page 50: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 51: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Foundation+ Observer

IODevices

+ AudioSample+ InputDevice+ OutputDevice+ PhoneLine- PhoneLineImpl- MicrophoneImpl- SpeakerImpl

Page 52: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

52July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 103

Class Symbols

t Indicateâ Types (interface)

F defines the signatures ofhow to communicate withall sub-types

â Base Classes (abstract)F also defines a type

F defines propertyimplementations to beinherited by sub-classclass

<<interface>>Observer

notify() : void

message : AudioCut

Message{Abstract}

play(device: OutputDevice) : void

device.play(message)

July 1998 Introduction to UML Slide 104

Class Symbols

t Parameterized(templates) Classesâ Defines type-independent

template structure andalgorithms

t Instantiated Classesâ Binds template to a data

type

T

vector

Audio

<<bind>><AudioSample>

vector<AudioSample>

Page 53: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

53July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 105

Adding Class Properties

t get()/set() operationsadded for public attributeproperties

t public (+), protected (#),and private (-) accessesdesignated for allproperties

t specify scopeâ object (no underline)

â class (underlined)

PhoneLineImpl

#deviceAddress_ : long#model : string

+play (audio : Audio) :

<<interface>>OutputDevice

+play (audio : Audio) :

<<interface>>PhoneLine

+hangup () :

July 1998 Introduction to UML Slide 106

Attribute/Operation Descriptions

Class: PhoneLineImpl

t Attributesâ-deviceAddress_ : long

Contains the i/o port number for the modem

tOperations:â+virtual play(audio : Audio) throw(NotReady, Hangup)

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.

Page 54: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 55: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

* non-UML terms

July 1998 Introduction to UML Slide 110

Sequence Diagram

time

objects

: Device Player : OutputDevice

: External Listener

2: Play ( )

4: Terminate ( )

1: Initialize ( )

3: Audio ( )Message

ReturnMessage (optional)

Activation(focus of control) Label

Page 56: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

56July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 111

Adding Guard Conditions

t Places a restriction onthe send of a message

t Each branch is labeledwith a [guard]

:MessageMode

:CallerMessage

:Mailbox

Record

[Message Not Empty]Record(CallerMessage)

[Message Empty]

July 1998 Introduction to UML Slide 112

Adding Concurrency

:MessageMode

:PhoneLine

Listen()Play()Stop()

Page 57: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

57July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 113

Adding Object Lifeline

:MessageMode

:CallerMessage

Create

Record

:ControlPanel

Play

Delete

Object is created

Object is deleted

July 1998 Introduction to UML Slide 114

Example: Answer Caller

: External Caller : PhoneLine : AnswerMode : Greeting

1: Ring ( )

3: Ring ( )

2: New Call ( )

4: New Call ( )

5: Answer ( )

9: Answer Complete ( )

10: Hangup ( )

6: Play ( )

7: Play ( )

8: Greeting Complete

Page 58: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

58July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 115

Example: Take Caller Message

: External Caller : PhoneLine : MessageMode : Mailbox : Speaker : (Message

Indicator)message :

CallerMessage

7: Disconnect ( )

2: CallerId ( )

1: Answer Complete ( )

9: Record (message)10: New Message ( )

3: Create (caller, timeOfCall)

4: Record (InputDevice)

5: Listen ( )

6: Play ( )

8: Caller Message Complete

July 1998 Introduction to UML Slide 116

Collaboration Diagram

t Show Collaborationâ Context (structure,

relationships, ...) in whichinteractions occur

t Show Interactionsâ Message sequencing

between objects

t Object format

: Device Player

: OutputDevice

: External Listener

1: Initialize ( )2: Play ( )

3: Audio ( )

4: Terminate ( )

MessageObject

Relationship

classRoleName : Classifier

Page 59: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

59July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 117

Adding Other Elements

: Device Player

Play ( )

: OutputDevice Devices

Multi-object

:MessageMode

Create ( )

: CallerMessage { new }

Object Lifetime ({new}, {deleted}, {transient})

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

July 1998 Introduction to UML Slide 118

Example: Answer and Take Caller Message

: External Caller

: PhoneLine

: AnsweringMachine

: MessageMode : CallerMessage

: Mailbox

G

1: Ring

F

F

2: notify ( int, void*)

F

F

3: newCall ( )5: CallerMessage (callerId , dateTime)

6: record (InputDevice&)

P

4: callerId ( )7: listen ( )

Audio

P

8: record (CallerMessage&)

F

F

<<global>> <<fieldl>>

<<field>>

<<field>>

<<field>>

<<field>>

<<field>>

<<local>>

<<parameter>>

<<parameter>><<parameter>>

Page 60: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

60July 1998 Rev 1.0 Introduction to UML

State Diagrams

July 1998 Introduction to UML Slide 120

State Diagram Overview

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

Page 61: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 62: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 63: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 64: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 65: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 66: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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

Page 67: Introduction to UML - Computer and Information Sciencecs.iupui.edu/~cs265/spring06/slides/t01IntroToUMLResource.pdf · July 1998 Rev 1.0 Introduction to UML 1 Introduction to UML

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)