uml and use cases cs 414, software engineering i mark ardis rose-hulman institute january 9, 2003

29
Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

Post on 20-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

Uml and Use Cases

CS 414, Software Engineering IMark Ardis

Rose-Hulman InstituteJanuary 9, 2003

Page 2: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

2

Outline

UML Use cases Sequence diagrams Activity diagrams How to write use cases

Page 3: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

3

Note About Slides

Some of these slides are from a course by Rational Software Corp.

Some of these slides are from Alastair Cockburn

Please respect their copyrights

Page 4: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

4

What Is the UML?

The Unified Modeling Language (UML) is a language for

Specifying Visualizing Constructing Documenting

the artifacts of a software-intensive system

Page 5: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

5

UML History

Page 6: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

Inputs to UML

Fusion

Operation descriptions,Message numbering

Meyer

Before and after conditions

Harel

State charts

Wirfs-Brock

Responsibilities

Embley

Singleton classes, High-level view

Odell

Classification

Shlaer - Mellor

Object Lifecycles

Gamma, et.al

Frameworks, patterns,notes

Booch

JacobsonRumbaugh

Page 7: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

7

The UML Provides Standardized Diagrams

DeploymentDiagram

DeploymentDiagram

Use CaseDiagrams

Use CaseDiagramsUse Case

Diagrams

Use CaseDiagramsUse Case

Diagrams

Use CaseDiagrams

ScenarioDiagrams

ScenarioDiagramsScenario

Diagrams

ScenarioDiagramsSequence

Diagrams

SequenceDiagrams

StateDiagrams

StateDiagramsState

Diagrams

StateDiagramsState

Diagrams

StateDiagrams

ComponentDiagrams

ComponentDiagramsComponent

Diagrams

ComponentDiagramsComponentDiagrams

ComponentDiagrams

Model

StateDiagrams

StateDiagramsState

Diagrams

StateDiagramsObject

Diagrams

ObjectDiagrams

ScenarioDiagrams

ScenarioDiagramsScenario

Diagrams

ScenarioDiagramsCollaboration

Diagrams

CollaborationDiagrams

Use CaseDiagrams

Use CaseDiagramsUse Case

Diagrams

Use CaseDiagramsActivity

Diagrams

ActivityDiagrams

StateDiagrams

StateDiagramsState

Diagrams

StateDiagramsClass

Diagrams

ClassDiagrams

Page 8: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

8

UML Diagrams Are Key System Artifacts

Actor A

Use Case 1

Use Case 2

Actor B

user : »ç¿ëÀÚ

mainWnd : MainWnd

fileMgr : FileMgr

repository : Repositorydocument : Document

gFile : GrpFile

9: sortByName ( )

L1: Doc view request ( )

2: fetchDoc( )

5: readDoc ( )

7: readFile ( )

3: create ( )

6: fillDocument ( )

4: create ( )

8: fillFile ( )

GrpFile

read( )open( )create( )fillFile( )

rep

Repository

name : char * = 0

readDoc( )readFile( )

(from Persistence)

FileMgr

fetchDoc( )sortByName( )

DocumentList

add( )delete( )

Document

name : intdocid : intnumField : int

get( )open( )close( )read( )sortFileList( )create( )fillDocument( )

fList

1

FileList

add( )delete( )

1

File

read( )

read() fill the code..

UI

MFC

RogueWave

global

DocumentApp

Persistence Window95

¹®¼ °ü¸® Ŭ¶óÀ̾ðÆ®.EXE

WindowsNT

¹®¼ °ü¸® ¿£Áø.EXE

WindowsNT

Windows95

Solaris

ÀÀ¿ë¼ ¹ö.EXE

AlphaUNIX

IBM Mainframe

µ¥ÀÌŸº£À̽º¼ ¹ö

Windows95

¹®¼ °ü¸® ¾ÖÇø´

ºÐ»ê ȯ°æÀÇ Çϵå¿þ¾î¹× ³×Æ®¿÷À¸·ÎÀÇ Á¤º¸ ½Ã½ºÅÛ ¿¬°á ¸ðµ¨ - À©µµ¿ì 95 : Ŭ¶óÀ̾ðÆ® - À©µµ¿ì NT: ÀÀ¿ë¼ ¹ö - À¯´Ð½º ¸Ó½Å: ÀÀ¿ë ¼ ¹ö ¹× µ¥ÀÌŸ ¼ ¹ö, Åë½Å ¼ ¹ö - IBM ¸ÞÀÎÇÁ·¹ÀÓ: µ¥ÀÌŸ ¼ ¹ö, Åë½Å ¼ ¹ö

Document

FileManager

GraphicFileFile

Repository DocumentList

FileList

user

mainWnd fileMgr : FileMgr

repositorydocument : Document

gFile

1: Doc view request ( )

2: fetchDoc( )

3: create ( )

4: create ( )

5: readDoc ( )

6: fillDocument ( )

7: readFile ( )

8: fillFile ( )

9: sortByName ( )

ƯÁ¤¹®¼ ¿¡ ´ëÇÑ º¸±â¸¦ »ç¿ëÀÚ°¡ ¿äûÇÑ´Ù.

È ÀÏ°ü¸®ÀÚ´Â Àоî¿Â ¹®¼ ÀÇ Á¤º¸¸¦ ÇØ´ç ¹®¼ °´Ã¼¿¡ ¼³Á¤À» ¿äûÇÑ´Ù.

È ̧é °´Ã¼´Â ÀоîµéÀÎ °´Ã¼µé¿¡ ´ëÇØ À̸§º°·Î Á¤·ÄÀ» ½ÃÄÑ È ̧é¿¡ º¸¿©ÁØ´Ù.

Customernameaddr

withdraw()fetch()send()

receive()

<<entity>>

Forward Engineering(Code Generation)and

Reverse Engineering

Executable System

User InterfaceDefinition

Domain Expert

Openning

Writing

ReadingClosing

add file [ numberOffile==MAX ] / flag OFF

add file

close file

close file

Use Case 3

Source Code edit, compile, debug, link

Use-Case Diagram

Class Diagram

Collaboration Diagram

Sequence Diagram

Component Diagram

State Diagram

Package Diagram

Deployment DiagramClass

Page 9: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

9

Rational Unified Process (RUP)

Management

Environment

Business Modeling

Implementation

Test

Analysis & Design

Preliminary Iteration(s)

Iter.#1

PhasesProcess Workflows

Iterations

Supporting Workflows

Iter.#2

Iter.#n

Iter.#n+1

Iter.#n+2

Iter.#m

Iter.#m+1

Deployment

Configuration Mgmt

Requirements

Elaboration TransitionInception Construction

Page 10: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

10

Business Modeling Workflow

Find Business Actorsand Use CasesBusiness-Process

Analyst

S tructure the Business Use-Case

M odel

Capture a Com m on

Vocabulary Business M odelReviewer

Review the Business

Use-Case M odel

Detail a Business Use Case

Business Designer

Review the Business

O bject M odelDetail a Business Entity

F ind Business W orkers and Entities

Detail a Business W orker

Page 11: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

11

Requirements Workflow

U se-C ase Specifier

R equirem entsR eview er

U ser-In terfaceD esigner

C apture a C om m on

Vocabulary

F ind Actors and U se C ases

R eviewR equirem ents

S tructure the U se-C ase M odel

U ser-In terfacePrototyp ing

D eta il a U se C ase

E lic it S takeholder N eeds

M anage D ependencies

Arch itectP rioritize

U se C ases

D evelopVision

U ser-In terfaceM odeling

Page 12: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

12

Analysis & Design Workflow

Architect

D esigner

A rchitectura lAnalysis

A rchitectureR eview er

R eview theD esign

R eview theArchitecture

U se-C aseAnalysis

A rchitectura lD esign

D escribeC oncurrency

D escribeD istribution

D atabaseD esigner

C lassD esign

Subsystem D esign

U se-C ase D esign

D atabaseD esign

D esignR eview er

Page 13: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

13

Outline

UML Use cases Sequence diagrams Activity diagrams How to write use cases

Page 14: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

14

Use-Case

Name Brief description Flows of Events Relationships Activity and State

diagrams Use-Case diagrams Special requirements Preconditions Postconditions Other diagrams

Use-Case Reports

...

Use Case Model

Actors

Use Cases

Page 15: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

Example Use-Case Diagram

Submit Grades

Professor

View Report Card

Select Courses to Teach

Student

Course Catalog

Register for Courses Maintain Student Information

Maintain Professor InformationRegistrar

Billing SystemClose Registration

Login

Page 16: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

16

Use-Case Flows of Events

Has one normal, basic flow ("Happy Path" or "Sunny Day Scenario")

Several alternative flows Regular variants Odd cases Exceptional flows handling error

situations

“Happy Path”

Page 17: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

What Are Scenarios ?

A scenario is an instance of a use case

Page 18: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

18

Checkpoints: Actors

Have all the actors been identified? Is each actor involved with at least one use

case? Is each actor really a role? Should any be

merged or split? Do two actors play the same role in relation to

a use case? Do the actors have intuitive and descriptive

names? Can both users and customers understand the names?

Page 19: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

19

Checkpoints: Use-Cases

Is each use case involved with at least one actor?

Is each use case independent of the others? Do any use cases have very similar behaviors

or flows of events? Do the use cases have unique, intuitive, and

explanatory names so that they cannot be mixed up at a later stage?

Do customers and users alike understand the names and descriptions of the use cases?

Page 20: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

A First Step Towards Executables

Use Cases AnalysisClasses

SourceCode

ExecDesignClasses

Page 21: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

21

Use Case Realization

Use Case Use Case Realization

<<realizes>>

Class Diagrams

Sequence Diagrams Collaboration Diagrams

Use Case Realization

Documentation

Use Case Model Design Model

Page 22: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

22

Outline

UML Use cases Sequence diagrams Activity diagrams How to write use cases

Page 23: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

23

Example: Sequence Diagram

: Student : MaintainScheduleForm

: RegistrationController

: Schedule : MainForm : CourseCatalogSystem

5: // select 4 primary and 2 alternate offerings( )

6: // add courses to schedule( )

7: // create with offerings( )

1: // select maintain schedule( )

2: // open schedule form( )

3: // get course offerings( )

4: // get course offerings( )

Page 24: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

24

AF3

One Interaction Diagram Not Good Enough

Alternate Flow 4 Alternate Flow 5 Alternate Flow n

Alternate Flow 1 Alternate Flow 2 Alternate Flow 3

AF1

AF2

Basic Flow

Page 25: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

25

Outline

UML Use cases Sequence diagrams Activity diagrams How to write use cases

Page 26: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

26

Select Course

CheckSchedule

CheckPre-requisites

Assign toCourse

ResolveConflict

UpdateSchedule

[checks completed] [checks failed]

[student addedto course]

Example: Activity Diagram

Page 27: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

27

Outline

UML Use cases Sequence diagrams Activity diagrams How to write use cases

Page 28: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

28

Cartoon of the Day

Page 29: Uml and Use Cases CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute January 9, 2003

29

Switch to other talk...