Introduction to UML A Practical Approach to Product Development - - PDF document

introduction to uml
SMART_READER_LITE
LIVE PREVIEW

Introduction to UML A Practical Approach to Product Development - - PDF document

Introduction to UML A Practical Approach to Product Development Description This seminar is designed to help you get started using the Unified Modeling Language (UML) as a visual design tool using a development process. A simple case


slide-1
SLIDE 1

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

This seminar is designed to help you get started using the Unified Modeling Language (UML) as a visual design tool using a development process. A simple case study is presented to demonstrate domain modeling and design techniques as an integrated method. Familiarity with object technology will enhance the attendee’s understanding of the models, but is not required.

slide-2
SLIDE 2

2 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 3

Speakers

Jim Stafford

­ DoD Contracting

! OO Mentoring ! UCA Framework System Engineering ! Distributed Computing Infrastructure

­ RABA Technologies, Inc ­ http://www.raba.com/~jcstaff ­ JHU/APL OOP/C++ Instructor ­ jcstaff@raba.com

Michele Moore

­ DoD Contracting

! OO Mentoring ! Software Development

­ RABA Technologies, Inc ­ JHU/SCS OOP, C++, Java instructor ­ michele.moore@raba.com

July 1998 Introduction to UML Slide 4

Objectives

Introduce UML in the context of a practical

  • bject-oriented work process

Introduce a proven object-oriented process Understand how UML models fit into the process Discover how to create UML models

slide-3
SLIDE 3

3 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 5

Agenda

(Day 1) Process and UML: Introduction

­UML Background ­Getting Started with Object Modeling ­Modeling At A Glance with UML ­Process Overview

(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

History of UML The “Methodology Wars” What UML is What UML is not

slide-4
SLIDE 4

4 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 7

History of UML

Design methods popularized in 70’s & 80’s Technical community inundated with models, methodologies, notations by early 90’s Standardization was needed, but no one was willing to champion the cause and make it successful; many were opposed to the idea OOPSLA ‘94 Grady Booch and James Rumbaugh announced the merging of their methods OOPSLA ‘95 revealed the first public description of the Unified Method, with Ivar Jacobson joining the duo During 1996, the “Three Amigos” worked on the new method, renaming it as the Unified Modeling Language (UML) In January ‘97, UML was proposed to OMG as a standard to facilitate the 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 - Booch Rational OMT - Rumbaugh, Blaha, Premerlani, Eddy, Lorensen GE ACC OOSE - Jacobson Objectory Coad/Yourdon - Coad Object International ... Others...

slide-5
SLIDE 5

5 July 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 Instance Connection Gen-Spec Part-Whole Jacobson Object Acquaintance Association Inherits Consists of Odell Object Type 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, Rumbaugh Rational OOSE - Jacobson Objectory Coad/Yourdon - Coad Object International ... Others...

slide-6
SLIDE 6

6 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 11

January 1997 UML from Rational

Unified Modeling Language Objectory Process

  • Booch, Rumbaugh

Rational Jacobson Objectory Coad/Yourdon - Coad Object International ... Others... UML v1.0 OMG

July 1998 Introduction to UML Slide 12

November 1997 UML from OMG

Objectory Process

  • Booch, Rumbaugh, Jacobson

Rational Coad/Yourdon - Coad Object International ... Others... UML v1.1

(v1.2 in draft)

OMG

slide-7
SLIDE 7

7 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 13

What UML Is

UML is a modeling language, a notation used to express and document designs UML unifies the notation of Booch, Rumbaugh (OMT) and Jacobson, and augmented with

  • ther contributors once submitted to OMG

UML proposes a standard for technical exchange of models and designs UML also defines a “meta-model”, a diagram that defines the syntax of the UML notation

July 1998 Introduction to UML Slide 14

What UML Is Not

UML is not a method or methodology

(Method = Notation (e.g.,UML) + Process)

UML does not dictate a particular process

(although the “Rational Objectory Process” is being proposed by Booch, Rumbaugh and Jacobson)

UML can be used to record the resulting domain and design models, independent of the process Choose an appropriate process for a particular project, independent of the modeling language

slide-8
SLIDE 8

8 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 15

Why Use UML

Standardized notation without sacrificing specialized model data Common language that can be used from product conception to delivery, from system to detailed design levels Reduced learning curve across projects Increased domain and design model reuse Increased customer involvement /understanding

  • f problem translation to product solution

July 1998 Introduction to UML Slide 16

Where to Start?

Identify key domain abstractions … classes integrating:

­ Attributes ­ Behavior (responsibilities, methods) ­ Messaging

! providing logical independence between client and object

­ Polymorphism

! providing physical independence between client and implementation

Consider relationships … integrating classes and objects to form higher levels of abstraction

­ Association (“Uses, Needs”) ­ Aggregation (“Has-A”) ­ Inheritance (“Is-A”)

Begin constructing your models

slide-9
SLIDE 9

9 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 17

Model Perspectives

Conceptual

!Book [Title]

­objects, “things” from the domain ­conceptual map to implementation

Specification

!BookIface { void setTitle(String value); }

­identifies how to obtain properties

Implementation

!PersistentBook : BookIface { -> DB }

­identifies how interface will be implemented

July 1998 Introduction to UML Slide 18

Initial Modeling Results

List of use cases, describing system requirements Domain model, capturing your understanding of the business process and key domain classes Design model, realizing both the information in the domain objects and the behavior described in the use cases Add classes in the design model that actually do the work and also provide a reusable architecture for future extensions

slide-10
SLIDE 10

10 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 19

UML Notation Baseline

Use Case Diagrams Class Diagrams Package Diagrams Activity Diagrams State-Transition Diagrams Event Trace (Interaction) Diagrams

­Sequence Diagrams ­Collaboration Diagrams

Deployment Diagrams

July 1998 Introduction to UML Slide 20

Use Case Diagrams

Show the external actors and their connection to the functionality (use cases) of the system Use cases provide the basis of communication between sponsors/customers and implementers in the planning

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

slide-11
SLIDE 11

11 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 21

Class Diagrams

Show the static structure of the domain abstractions (classes) of the system Describe the types of objects in the system and the various kinds of static relationships that exist among them

­ Associations ­ Derivations

Show the attributes and

  • perations of a class and

the constraints for the way 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 name IDNumber

July 1998 Introduction to UML Slide 22

Package Diagrams

Shows the breakdown of larger systems into a logical grouping of smaller subsystems (e.g, Coad/Yourdon’s Subject Layer) Shows groupings of classes and the dependencies among them A dependency exists between two elements if changes to the definition of one element may cause changes to the other

University Artifacts Interfaces Database global

slide-12
SLIDE 12

12 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 23

Activity Diagrams

Show the sequential flow of activities

­ typically in an operation ­ also in a use case or event trace

Complement the class diagram by showing the workflow of the business (aka “Flowchart”) Encourage discovery of parallel processes which helps eliminate unnecessary sequences in business processes

Select Courses Confirm Availability for each chosen course Buy Book Attend Class

July 1998 Introduction to UML Slide 24

State-Transition Diagrams

Show all the possible states that objects of the class can have and which events cause them to change Show how the object’s state changes as a result of events that are handled by the object Good to use when a class has complex lifecycle behavior

Selecting select a course Confirming select a course course selected course not available Registering Register student for courses all courses confirmed Completed registration db updated

slide-13
SLIDE 13

13 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 25

Interaction (Event Trace) Diagrams (1)

Sequence Diagrams

Show the dynamic collaboration between objects for a sequence of messages sent between them in a sequence of time Time sequence is easier to see in the sequence diagram, read from top to bottom Choose sequence diagram when only the sequence of

  • perations needs to be shown

: Registrar course form : NewCourseForm Sales 101 : Course : Transaction Manager : DBCourse

  • pe

set info submit for processing newCourse ( ) course saveCourse ( saveCourse ( getInfo (

Create a course

July 1998 Introduction to UML Slide 26

Interaction (Event Trace) Diagrams (2)

Collaboration Diagrams

Show the actual objects and their links, the “network of

  • bjects” that are collaborating

Time sequence is shown by numbering the message label

  • f the links between objects

Choose collaboration diagram when the objects and their links facilitate understanding the interaction, and sequence

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

slide-14
SLIDE 14

14 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 27

Deployment Models

Show the physical architecture

  • f the hardware and software
  • f the system

Highlight the physical relationships among software and hardware components in the delivered system Components on the diagram typically represent physical modules of code and correspond exactly to the packages on a package diagram

Registration System Database Dorm Main Building Library

July 1998 Introduction to UML Slide 28

Process Overview

Conceptualization Requirements Definition Architecture Design Package Development Delivery Maintenance

slide-15
SLIDE 15

15 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 29

Conceptualization

(entire system)

Define Purpose and Prioritized Features “Sketch” Early Domain Class Model Identify Use Cases and Primary Paths Identify Schedule, Risks, Resources

July 1998 Introduction to UML Slide 30

Domain Class Model Example

1 1 PhoneLine 1 0..* CallerMessage 2 Greeting Answer Mode 1 AnsweringMachine 1 1 1 0..* 2 1

slide-16
SLIDE 16

16 July 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 Update Indicator Play to Output Device Record Caller Message [Message] [No Message] [Call Stopped]

Take Caller Message

July 1998 Introduction to UML Slide 32

Use Case Identification Example

Actors: External Caller, External Owner Use Case: Answer Caller Use Case: Review Caller Message Use Case: Record Greeting Use Case: Set Answer Model Use Case: Take Caller Message Use Case: Play Greeting Use Case: Delete Caller Message

slide-17
SLIDE 17

17 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 33

Conceptualization Applied

Consider a University Student Registration System

­Identify 5 key abstractions, attributes, responsibilities, relationships

(Eyes on your own paper! :)

July 1998 Introduction to UML Slide 34

Exercise Results

slide-18
SLIDE 18

18 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 35

Requirements Definition

(per build OR entire system) Define Domain Class Model Describe Use Cases, Primary & Alternate Paths Map Requirements to Classes & Use Cases/Use Case Paths

Results

  • Documented in an Operational Concept Document (OCD) and

Software Requirements Spec (SRS)

  • Presented at Software Requirements Review (SRR)

Functional Requirement Data Requirement Use Case Use Case Path Domain Class

breaks down into

  • ne or more

helps id helps id mapped to mapped to

July 1998 Introduction to UML Slide 36

Domain Class Model Example

1 Greeting Greeting Play( ) 1 1 0..* CallerMessage DateTime Caller Reviewed Message Record( ) Play( ) Delete( ) 1 PhoneLine RingCount Answer( ) Play( ) Listen( ) Hangup( ) 1 1 2 AnswerMode Answer Ring 1 1 1 Mailbox Total Messages New Message Count 1 0..* 1 1 Speaker Play( ) 1 AnsweringMachine 1 1 1 2 1 1 1 1 <<uses>> <<uses>> <<uses>> <<uses>>

slide-19
SLIDE 19

19 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 37

Class Specification Example

Class: CallerMessage Messages are recorded from the caller with associated information. The caller messages are flagged as new until the owner reviews them and are only deleted 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 are deleted 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 the

  • wner 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 Message

1.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 caller message to the owner on playback. (Req-11, Review Caller Messages) 3.The Answering System shall output the identity of the caller of the caller message to the owner on playback. (Req-12, Review Caller Messages) 4.The Answering System shall provide the capability for an owner to review new caller messages only. (Req-14, Review Caller Messages)

…etc.

slide-20
SLIDE 20

20 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 39

Requirements Definition Applied

Identify 5 System Requirements for the University Student Registration System Describe them as specific use cases

July 1998 Introduction to UML Slide 40

Exercise Results

slide-21
SLIDE 21

21 July 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 Caller

  • This 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 mode specific processing.

Actors:

­ Caller

Pre-conditions:

­ Answering machine is idle

Post-conditions:

­ Greeting is played to caller ­ Mode-specific processing is performed

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

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.

slide-22
SLIDE 22

22 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 43

Architecture Design

(entire system)

Identify package boundaries and allocate primary responsibility of domain classes to a package Break complex use cases into uses relationships that fit within identified packages Identify interfaces for domain classes that cross package boundaries Define event traces for key interactions between packages 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 Trace Concrete Analysis Scenario Domain Class

ids used to implement

Concrete Use Case Scenario 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

slide-23
SLIDE 23

23 July 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 line

connected to the phone line.

  • 2. The phone line reports the event of a

new call to the current answer mode. 3-4. The answer mode waits for the

  • wner-specified.
  • 5. The phone line is told to answer the

caller. 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 Script

  • 1. The caller rings the phone line

connected to the phone line.

  • 2. The phone line reports the event of a

new call to the current answer mode. 3-4. The answer mode waits for the

  • wner-specified.
  • 5. The phone line is told to answer the

caller. 6-8. The answer mode plays the greeting.

  • 9. The specific answer mode will

perform any mode-specific processing

Use Case Script

  • 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

slide-24
SLIDE 24

24 July 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 Indicator message : 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 a

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

  • utput device. (Pkg-10)
  • 2. The Answering System shall output the date and time of the caller message

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

  • played. (Pkg-19)
slide-25
SLIDE 25

25 July 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 caller

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

new 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

Class Design (per customer build)

­ Identify internal design classes and their interfaces ­ Define Method Traces ­ Results

! Documented in SDD ! Presented at CDR

Class Implementation (per internal build)

­ Implement classes ­ Unit & Integration Testing

Package Integration

­ Software Integration Testing (SWIT)

Event Trace Concrete Analysis Scenario Method Trace Concrete Design Scenario Class Design

ids details for used to implement tested by tested by

Code

ids context for

slide-26
SLIDE 26

26 July 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 P P G F F F F F F L

Take Caller Message

slide-27
SLIDE 27

27 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 53

Delivery

(per build)

Integrate Changes System Testing Develop/Update User Documentation Field System Track Error Reports Deployment Diagrams

July 1998 Introduction to UML Slide 54

Maintenance

Collect Change/Enhancement Requests

­Prioritize ­Group

Enter the Process Spiral Again

slide-28
SLIDE 28

28 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 55

Overall Process Mapping

Functional Requirement Data Requirement Use Case Use Case Path Event Trace Concrete Analysis Scenario Method Trace Concrete Design Scenario Domain Class Class Design

breaks down into

  • ne or more

helps id helps id ids used to implement ids details for used to implement tested by tested by

Code

ids context for mapped to mapped to Concrete Use Case Scenario tested by

July 1998 Introduction to UML Slide 56

Process Roles

Requirements Use Cases Use Case Paths Domain Classes Event Traces Class Designs Message Traces Code Unit Test Integration Test Acceptance Testing Customer Customer Representative System Engineer Software Architect Subsystem Lead Developer Subsystem Lead System Engineer

slide-29
SLIDE 29

29 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 57

Session 2: Process Insertion

Process Goals / Results

­Conceptualization ­Requirements Definition ­Architecture Design ­Package Development ­Delivery ­Maintenance

UML In Action

­Case Study: Answering Machine System

July 1998 Introduction to UML Slide 58

Conceptualization/Requirements Definition Models Domain Class Model Use Case Models Activity Diagrams Requirements Management

slide-30
SLIDE 30

30 July 1998 Rev 1.0 Introduction to UML

Class Models

Conceptual Level

July 1998 Introduction to UML Slide 60

Class Model Overview

Shows static properties of a Class Depicted graphically in Class Diagrams and textually in Class Specifications May be organized into Packages Class Diagrams

­Show an aspect of a set of Classes ­Need not contain entire Package ­Need not be restricted to Package boundaries

slide-31
SLIDE 31

31 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 61

Packages

AnsweringSystem IODevices Messages

Messages + CallerMessage + Mailbox + Greeting

Grouping of model elements (including non- class models) Can be nested Lists classes (optional) contained within package

­ + Public Visibility ­ -/# Non-public Visibility

July 1998 Introduction to UML Slide 62

Class Symbols

Solid rectangle Three compartments

­ Class Name and general properties (optional)

! Package (Package::) ! Stereotypes (<< >>) ! Constraints ({ } ) ! Meta-model attributes

­ Attributes (optional) ­ Operations (optional)

Additional compartments allowed

CallerMessage Mailbox { author=“bob” } Greeting <<controller>> AnsweringSystem::AnswerMode IODevices::OutputDevice responsibilities Output Audio IODevices::InputDevice AnsweringMachine {1}

slide-32
SLIDE 32

32 July 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 with associated information. The caller messages are flagged as new until the owner reviews them and are only deleted upon specific request.

July 1998 Introduction to UML Slide 64

Adding Class Properties

Attributes

­ Describing data properties

  • f a class

Operations (Behaviors)

­ Describing localized behavior of a class

CallerMessage DateTime Caller Reviewed Message Record( ) Play( ) Delete( ) Stop( )

slide-33
SLIDE 33

33 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 65

Property Descriptions

Class: CallerMessage Attributes

­DateTime - The caller message is recorded with the date/time at the start of the call.

Behaviors (Operations)

­Record() - Caller messages are recorded from the phone line and are terminated when the caller hangs up, the maximum message length has been reached,

  • r the owner terminates the recording. Empty

messages 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

slide-34
SLIDE 34

34 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 67

Associations

Name (optional)

further describes association between members

Roles

role played by associated member

­ named ­ unnamed

Multiplicity

quantity 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 Answering Machine has “2” modes The related Answer Modes play the role

  • f the Answering

Machine’s “Answer Modes” An Answer Mode is associated with “1” Answering Machine The Greeting plays the role of a “Greeting” There is “1” Greeting per Answer Mode A Greeting is associated 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 controlled by” Answer Modes

slide-35
SLIDE 35

35 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 69

Adding Properties to Associations

Person Name SSN Company Name 0..* 0..* 0..* 0..* Employment

Employment Hire Date Termination Date Salary

Person Name SSN Company Name 0..* 0..* 0..* 0..*

Use Attributed Class to add properties unique to the association between two classes Use named/unnamed associations where there are no properties unique to the association between two classes

July 1998 Introduction to UML Slide 70

Adding Constraints on Associations

Person CallerMessage Organization {or}

The caller will be identified as either a person

  • r an
  • rganization
slide-36
SLIDE 36

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

Aggregation (open diamond)

­ shows side of association that represents the aggregate

Composite (filled in diamond)

­ A refinement of aggregation showing the aggregate having

  • wnership of the member

Aggregation Composite

July 1998 Introduction to UML Slide 72

Adding Uses Dependency Association

Uses Relationship

dependency shown with <<uses>> stereotype ­ shows a usage relationship between associated classes ­ the association is temporary (created and forgotten during the completion of a behavior)

InputDevice OutputDevice CallerMessage <<uses>> <<uses>>

Dependency Relationship

shown by dashed directed arrow

slide-37
SLIDE 37

37 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 73

Association Descriptions

Class: CallerMessage Associations:

­Mailbox [1] - Caller messages are assigned to a particular mailbox.

Class: Mailbox Associations:

­CallerMessage [0..*] - A mailbox contains all caller messages until they are deleted.

Uses:

­OutputDevice - Caller Messages are played to the specified output device.

July 1998 Introduction to UML Slide 74

Inheritance

Indicates type/sub-type

­ derived classes (sub-type) comply with base class (type) interface definitions

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

slide-38
SLIDE 38

38 July 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 is the base class of Microphone and PhoneLine Microphone “is-a” type of InputDevice PhoneLine “is-a” type

  • f InputDevice and

OutputDevice

July 1998 Introduction to UML Slide 76

Inheritance Descriptions

Class: OutputDevice Behaviors:

­Play() - Output devices can play audio.

Class: PhoneLine Inheritance:

­OutputDevice, InputDevice

Behaviors:

­Play() - Audio can be played to the phone line until the caller or system hangs up.

slide-39
SLIDE 39

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

slide-40
SLIDE 40

40 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 79

Example: Messages Package

InputDevice OutputDevice 0..* CallerMessage DateTime Caller Reviewed Message Record( ) Play( ) Delete( ) Stop( ) <<uses>> <<uses>> 1 1 Mailbox Total Messages New Message Count Record( ) Play( ) 0..* 1 1 1 AnsweringMachine 1 1 2 1 Greeting Answer Mode Greeting Record( ) Play( ) Stop( ) <<uses>> <<uses>> 1 AnswerMode 1 2 1 1

July 1998 Introduction to UML Slide 80

Example: Answering System Package

PhoneLine MessageMode Max Message Length New Call( ) AnnounceMode 1 Greeting 1 1 2 AnswerMode Answer Ring New Call( ) 1 1 1 Mailbox 1 1 1 1 1 Speaker 1 AnsweringMachine 1 2 1 1 1 1 1 1 1 Microphone 1 1

slide-41
SLIDE 41

41 July 1998 Rev 1.0 Introduction to UML

Use Cases

Specifications and Use Case Diagrams

July 1998 Introduction to UML Slide 82

Use Case Overview

Represents the functionality of the system (or class) as seen by the external user

slide-42
SLIDE 42

42 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 83

Use Case Diagram Elements

Use Case

shown by oval with name inside or below oval - may also contain compartment for extension points

­ unit of useful functionality provided by system ­ sequence of actions

External Owner External Caller Review Caller Message Take Caller Message

Actor

shown by a stick figure with name

­ role of an object or objects external to the system ­ one object may play many roles

Answer Caller extension points mode-specific processing

July 1998 Introduction to UML Slide 84

Use Case Specification

Use Case: Answer Caller This 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 mode specific processing.

  • Pre-conditions:

­ Answering machine is idle

  • Post-conditions:

­ Greeting is played to caller ­ Mode-specific processing is performed

  • 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

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

slide-43
SLIDE 43

43 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 85

Adding Use Case Relationships

Answer Caller Take Caller Message Play Greeting External Caller <<extends>> <<uses>>

Uses Extends Communicates

July 1998 Introduction to UML Slide 86

Adding Use Case Relationships

Answer Caller Take Caller Message Play Greeting External Caller <<extends>> <<uses>>

Communicates

  • participation of an

actor in a use case

  • the only

relationship between an actor and a use case Uses

  • specifies that the

using use case will also include behavior

  • f the use use case

Extends

  • the extended use

case may contain behavior specified by extending use case

slide-44
SLIDE 44

44 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 87

Communicates Relationship

Participation of an actor in a use case This is the only relationship between actors 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

Specifies that the using use case will also include behavior of the used use case

Answer Caller Play Greeting External Caller <<uses>>

Used Use Case: Play Greeting Using Use Case: Answer Caller includes the same behavior specified in

slide-45
SLIDE 45

45 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 89

Extends Use Case

The extended use case may contain behavior specified by extending use 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 Actor:

­External Caller

Uses:

­Play Greeting

Extension Points

­Mode-specific process will be performed after greeting is complete.

slide-46
SLIDE 46

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

slide-47
SLIDE 47

47 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 93

Activity Diagram Overview

Represents the state of a procedure

­Each state represents a step in the procedure ­The exit event from the state is the completion of the procedure

Shows a workflow of

­Use Cases (Requirements Definition) ­Operations (Package Specification)

Can show concurrency

July 1998 Introduction to UML Slide 94

Answer Phone Line Play Greeting Update Indicator Play to Output Device Record Caller Message [Message] [No Message]

Answering System Example

[Call Stopped]

Take Caller Message

slide-48
SLIDE 48

48 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 95

Activity Diagram Symbols

Synchronization Bar Guard Decision Activity

Answer Phone Line Play Greeting Update Indicator Play to Output Device Record Caller Message [Message] [No Message]

Activity Initial State End State State Transition Synchronization Condition

[Call Stopped]

July 1998 Introduction to UML Slide 96

Review Messages

Multiple Triggers

Play Message

*

Multiple Trigger

slide-49
SLIDE 49

49 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 97

Object Flows

Answer Phone Line Play Greeting Update Indicator Play to Output 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 Update Indicator Play to Output Device Record Caller Message [Message] [No Message]

Answering System Messages IO Devices

[Call Stopped]

slide-50
SLIDE 50

50 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 99

Architecture Design: Results

Class Models Method Traces Event Traces State Models Component Models Deployment Models

Class Design Models

Specification and Implementation Levels

slide-51
SLIDE 51

51 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 101

Class Design Model Overview

Specification

­Define interfaces to software implementing the domain class model

Implementation

­Shows where and how implementations are performed

July 1998 Introduction to UML Slide 102

Packages

Begin to identify classes that define the interface and the public/non-public classes that implement those interfaces

Foundation

+ Observer IODevices + AudioSample + InputDevice + OutputDevice + PhoneLine

  • PhoneLineImpl
  • MicrophoneImpl
  • SpeakerImpl
slide-52
SLIDE 52

52 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 103

Class Symbols

Indicate

­ Types (interface)

! defines the signatures of how to communicate with all sub-types

­ Base Classes (abstract)

! also defines a type ! defines property implementations to be inherited by sub-class class

<<interface>> Observer notify() : void message : AudioCut Message {Abstract} play(device: OutputDevice) : void device.play(message)

July 1998 Introduction to UML Slide 104

Class Symbols

Parameterized (templates) Classes

­ Defines type-independent template structure and algorithms

Instantiated Classes

­ Binds template to a data type

T

vector Audio <<bind>>

<AudioSample> vector<AudioSample>

slide-53
SLIDE 53

53 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 105

Adding Class Properties

get()/set() operations added for public attribute properties public (+), protected (#), and private (-) accesses designated for all properties 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 Attributes

­-deviceAddress_ : long

Contains the i/o port number for the modem

Operations:

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

Plays the vector of audio samples to the modem. Will throw a NotReady exception if the modem is not ready or a Hangup exception if the line is hung-up during the play.

slide-54
SLIDE 54

54 July 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) : void hangup () : void Message

OututDevice

PhoneLineImpl deviceAddress : long play (audio : Audio) : void hangup () : void

Message PhoneLineImpl deviceAddress : long play (audio : Audio) : void hangup () : void

Implementations will be put together at run-time Using implementations will be coupled to a sub- set (interface) of the used implementation’s capabilities UML offers a shorthand interface notation

Interaction Diagrams

Sequence and Collaboration Diagrams

slide-55
SLIDE 55

55 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 109

Interaction Diagram Overview

Shows interaction between objects Varying levels of detail

­Events (Event Trace*) ­Methods (Method Trace*)

Sequence Diagram

­Visually arranged in time-order of messages ­Shows lifeline of objects

Collaboration Diagram

­Visually arranged around objects ­Shows object relationships * non-UML terms

July 1998 Introduction to UML Slide 110

Sequence Diagram

time

  • bjects

: Device Player : OutputDevice : External Listener 2: Play ( ) 4: Terminate ( ) 1: Initialize ( ) 3: Audio ( )

Message Return Message (optional) Activation (focus of control) Label

slide-56
SLIDE 56

56 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 111

Adding Guard Conditions

Places a restriction on the send of a message Each branch is labeled with a [guard]

:Message Mode :Caller Message :Mailbox Record [Message Not Empty] Record(CallerMessage) [Message Empty]

July 1998 Introduction to UML Slide 112

Adding Concurrency

:Message Mode :PhoneLine Listen() Play() Stop()

slide-57
SLIDE 57

57 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 113

Adding Object Lifeline

:Message Mode :Caller Message Create Record :Control Panel 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

slide-58
SLIDE 58

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

Show Collaboration

­ Context (structure, relationships, ...) in which interactions occur

Show Interactions

­ Message sequencing between objects

Object format

: Device Player : OutputDevice : External Listener 1: Initialize ( ) 2: Play ( ) 3: Audio ( ) 4: Terminate ( )

Message Object Relationship

classRoleName : Classifier

slide-59
SLIDE 59

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

slide-60
SLIDE 60

60 July 1998 Rev 1.0 Introduction to UML

State Diagrams

July 1998 Introduction to UML Slide 120

State Diagram Overview

Shows sequence of states an object goes through in response to a stimuli Shows actions and activities performed and events issued Allows identification of missing

­Attributes - to remember states ­Behaviors - to receive events

slide-61
SLIDE 61

61 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 121

Caller Message Example

Recording entry: set date/time entry: set caller id do: ^InputDevice.Listen New Hangup[ Message not empty ] Reviewed Playing do: ^OutputDevice.Play Idle Deleted Hangup[ Message empty ] Play / set reviewed = true Playing do: ^OutputDevice.Play Idle Play Complete Delete Record

July 1998 Introduction to UML Slide 122

State Diagram Elements

Recording entry: set date/time entry: set caller id do: ^InputDevice.Listen Hangup[ Message not empty ] Hangup[ Message empty ] Record

State Event

Start

Guard Condition Action Activity Event Transition

End

slide-62
SLIDE 62

62 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 123

Key Diagram Elements

Transition

­Event arg-list [ guard condition ] / action expression

Action - atomic, non-interruptible

­entry / expression ­exit / expression ­Send Action

!^Target Object.Message(arguments)

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

slide-63
SLIDE 63

63 July 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 Deleted Hangup[ Message empty ] Play / set reviewed = true Playing do: ^OutputDevice.Play Idle Play Complete Delete

July 1998 Introduction to UML Slide 126

Concurrent States

Taking Message Recording Playing to Output Device Recording Playing to Output Device

slide-64
SLIDE 64

64 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 127

Updating Class Model

Recording entry: set date/time entry: set caller id do: ^InputDevice.Listen New Hangup[ Message not empty ] Reviewed Playing do: ^OutputDevice.Play Idle Deleted Hangup[ Message empty ] Play / set reviewed = true Playing do: ^OutputDevice.Play Idle Play Complete Delete Record

CallerMessage Caller Reviewed DateTime Record( ) Play( ) Delete( )

Deployment Diagrams

slide-65
SLIDE 65

65 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 129

Deployment Diagram Overview

Shows mapping of software components to hardware

­node - a computer ­connection - a link between nodes ­components - physical modules of code ­dependencies - show communication between components

July 1998 Introduction to UML Slide 130

Deployment Diagram

Messages AnsweringSystem IODevices

Node Dependency

Workstation Phone Company

Connection Components

slide-66
SLIDE 66

66 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 131

Refining Dependencies into Interfaces

AnsweringSystem Messages IODevices

InputDevice OutputDevice PhoneLine Greeting CallerMessage Mailbox

Interface

July 1998 Introduction to UML Slide 132

UML and Design Patterns

Use patterns to describe the key ideas in the system Document the designs that have been discarded; sometimes it is just as important to know why certain patterns/ideas are not being used Use UML to capture the pattern’s context for solving this domain problem

slide-67
SLIDE 67

67 July 1998 Rev 1.0 Introduction to UML

July 1998 Introduction to UML Slide 133

Modeling and UML

What makes a good model? When to apply UML How to apply UML

July 1998 Introduction to UML Slide 134

Summary

UML is a modeling language that can be used totally independent of the development process UML has been adopted by the OMG and is quickly becoming the notation of choice for visual modeling 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)