Вы находитесь на странице: 1из 83

Object Modeling with OMG UML Tutorial Series

Introduction to UML: Structural

.co n
Modeling and Use Cases

o
m
nce si
ua er
w.n l V Cris Kobryn
ww ia
Co-Chair UML Revision Task Force
r
November 2000
T

© 1999-2000 OMG and Tutorial Contributors: EDS, IBM, Enea Data, InLine Software,
IntelliCorp, Kabira Technologies, Klasse Objecten, ObjectTime Ltd., Rational Software, Unisys
Overview
! Tutorial series

.co n
! Quick tour

o
Structural modeling

m
nce si
!

Use case modeling

ua er
!

w.n l V
ww ia
r
T

Introduction to UML 2
Tutorial Series
! Lecture 1: Introduction to UML:

.co n
Structural Modeling and Use Cases

o
m
Lecture 2: Behavioral Modeling with

nce si
!

ua er
UML
!
w.n l V
Lecture 3: Advanced Modeling with UML
ww ia
! Lecture 4: Metadata Integration with
r
UML, MOF and XMI
T

Introduction to UML 3
Tutorial Goals
! What you will learn:

.co n
! what the UML is and what is it not

o
UML’s basic constructs, rules and diagram

m
!

nce si
techniques

ua er
! how the UML can model large, complex systems
how the UML can specify systems in an
w.n l V
!
implementation-independent manner
how UML, XMI and MOF can facilitate metadata
ww ia
!
integration
r
What you will not learn:
T
!
! Object Modeling 101
! object methods or processes
! Metamodeling 101

Introduction to UML 4
Quick Tour
! Why do we model?

.co n
! What is the UML?

o
Foundation elements

m
nce si
!

Unifying concepts

ua er
!

Language architecture
!

! w.n l V
Relation to other OMG technologies
ww ia
r
T

Introduction to UML 5
Why do we model?

Provide structure for problem solving

.co n
!

o
Experiment to explore multiple solutions

m
nce si
!

ua er
! Furnish abstractions to manage complexity
!
w.n l V
Reduce time-to-market for business
problem solutions
ww ia
r
Decrease development costs
T
!

! Manage the risk of mistakes

Introduction to UML 6
The Challenge

.co n
o
m
nce si
ua er
w.n l V
ww ia
r
T

Tijuana “shantytown”:
http://www.macalester.edu/~jschatz/residential.html

Introduction to UML 7
The Vision

.co n
o
m
nce si
ua er
w.n l V
ww ia
r
T

Fallingwater:
http://www.adelaide.net.au/~jpolias/FLW/Images/FallingWater.jpeg

Introduction to UML 8
Why do we model graphically?
! Graphics reveal data.

.co n
Edward Tufte

o
!

m
The Visual Display of Quantitative Information,

nce si
1983

ua er
! w.n l V
1 bitmap = 1 megaword.
ww ia
! Anonymous visual modeler
Tr

Introduction to UML 9
Quick Tour
! The UML is a graphical language for

.co n
specifying

o
!

m
visualizing

nce si
!

constructing

ua er
!

! documenting
w.n l V
the artifacts of software systems
ww ia
! Added to the list of OMG adopted
technologies in November 1997 as UML 1.1
Tr
! Most recent minor revision is UML 1.3,
adopted in November 1999

Introduction to UML 10
UML Goals
! Define an easy-to-learn but semantically rich visual

.co n
modeling language

o
Unify the Booch, OMT, and Objectory modeling

m
!

nce si
languages

ua er
! Include ideas from other modeling languages
Incorporate industry best practices
w.n l V
!

! Address contemporary software development issues


scale, distribution, concurrency, executability, etc.
ww ia
!

! Provide flexibility for applying different processes


r
Enable model interchange and define repository
T
!
interfaces

Introduction to UML 11
OMG UML Evolution
<<document>>
2002
UML 2.0
(planned major revision)

.co n
o
[backward compatible]
<<document>>

m
2001

nce si
UML 1.5
(planned minor revision)
<<document>>
ISO Publicly

ua er
Available
Specification
<<document>>
Q4 2000
UML 1.4
(planned minor revision)

1999
w.n l V <<document>>
UML 1.3
[read only]
ww ia
Editorial revision with no The expected result of OMG's
significant technical changes. formal liaison with ISO.
Tr
<<document>>
1998 UML 1.2

1997 <<document>>
(adopted by OMG) UML 1.1

Introduction to UML 12
OMG UML Contributors
Aonix Microsoft

.co n
Colorado State University ObjecTime

o
Computer Associates Oracle

m
nce si
Concept Five Ptech
Data Access OAO Technology Solutions

ua er
EDS Rational Software

w.n l V
Enea Data Reich
Hewlett-Packard SAP
ww ia
IBM Softeam
I-Logix Sterling Software
r
InLine Software Sun
T
Intellicorp Taskon
Kabira Technologies Telelogic
Klasse Objecten Unisys
Lockheed Martin …

Introduction to UML 13
OMG UML 1.3 Specification

! UML Summary

.co n
UML Semantics

o
!

m
nce si
! UML Notation Guide

ua er
! UML Standard Profiles

w.n l V
! Software Development Processes

! Business Modeling
ww ia
UML CORBAfacility Interface Definition
r
!
T
! UML XML Metadata Interchange DTD
! Object Constraint Language

Introduction to UML 14
Tutorial Focus: the Language
! language = syntax + semantics

.co n
! syntax = rules by which language elements

o
(e.g., words) are assembled into

m
nce si
expressions (e.g., phrases, clauses)

ua er
! semantics = rules by which syntactic
w.n l V
expressions are assigned meanings
UML Notation Guide – defines UML’s
ww ia
!
graphic syntax
Tr
! UML Semantics – defines UML’s
semantics
Introduction to UML 15
Foundation Concepts
! Building blocks

.co n
! Well-formedness rules

o
m
nce si
ua er
w.n l V
ww ia
r
T

Introduction to UML 16
Building Blocks
! The basic building blocks of UML are:

.co n
! model elements (classes, interfaces, components,

o
use cases, etc.)

m
nce si
! relationships (associations, generalization,

ua er
dependencies, etc.)
diagrams (class diagrams, use case diagrams,
w.n l V
!
interaction diagrams, etc.)
Simple building blocks are used to create large,
ww ia
!
complex structures
Tr
! cf. elements, bonds and molecules in chemistry
! cf. components, connectors and circuit boards in
hardware

Introduction to UML 17
Diagram: Classifier View

.co n
o
Element

m
nce si
ua er
w.n l V
ww ia
r
<<covalent>>
T
C
Carbon Hydrogen
C H

<<covalent>> C

Introduction to UML 18
Diagram: Instance View

.co n
:Hydrogen :Hydrogen

o
m
nce si
ua er
w.n l V
:Hydrogen :Carbon
ww ia :Carbon :Hydrogen
Tr
:Hydrogen :Hydrogen

Introduction to UML 19
Well-Formedness Rules
! Well-formed: indicates that a model or model
fragment adheres to all semantic and syntactic rules

.co n
that apply to it.

o
m
nce si
! UML specifies rules for:

ua er
! naming
scoping

w.n l V
!

! visibility
integrity
ww ia
!

execution (limited)
r
!
T
! However, during iterative, incremental development
it is expected that models will be incomplete and
inconsistent.

Introduction to UML 20
Well-Formedness Rules (cont’d)
! Example of semantic rule: Class [1]

.co n
English: If a Class is concrete, all the Operations of

o
!

the Class should have a realizing Method in the full

m
nce si
descriptor.

ua er
! OCL: not self.isAbstract implies

w.n l V
self.allOperations->
forAll (op | self.allMethods->
ww ia
exists (m | m.specification->
Tr
includes(op)))

Introduction to UML 21
Well-Formedness Rules (cont’d)
! Example of syntactic rules: Class

.co n
Basic Notation: A class is drawn as a solid-outline

o
!

rectangle with three compartments separated by

m
nce si
horizontal lines.

ua er
! Presentation Option: Either or both of the attribute

w.n l V
and operation compartments may be suppressed.
Example of syntactic guideline: Class
ww ia
!
r
Style Guideline: Begin class names with an
T
!

uppercase letter.

Introduction to UML 22
Unifying Concepts
! classifier-instance dichotomy

.co n
! e.g., an object is an instance of a class OR

o
a class is the classifier of an object

m
nce si
! specification-realization dichotomy

ua er
! e.g., an interface is a specification of a class OR

w.n l V
a class is a realization of an interface
analysis-time vs. design-time vs. run-time
ww ia
!

modeling phases (“process creep”)


r
!
T
! usage guidelines suggested, not enforced

Introduction to UML 23
Language Architecture
! Metamodel architecture

.co n
! Package structure

o
m
nce si
ua er
w.n l V
ww ia
r
T

Introduction to UML 24
Metamodel Architecture
<<metamodel>>
MOF Meta-Metamodel
«metaclass» «metaclass» «metaclass»
Attribute Class Operation

.co n
«instanceOf» «instanceOf»
<<use>>
«instanceOf»

o
<<metamodel>>

m
UML Metamodel

nce si
«metaclass» «metaclass» «metaclass»

ua er
Attribute Class Operation

w.n l V
«instanceOf»
<<use>>

Analysis Model The operation


ww ia
issue of the
The attribute fare of
PassengerTicket
the PassengerTicket
PassengerTicket class is an
class is an instance of
instance of the
the metaclass
+issuedBy : Airline metaclass
Attribute.
r
+issuingAgent : TravelAgent Operation.
+fare : Currency
T
+tax : Currency
+total()
+issue()
+surrender()
+refund()

«instanceOf»

Represents the
45723990550: PassengerTicket
User Object layer
of the 4-layer
From Modeling CORBA Applications with +issuedBy : Airline = AcmeAirlines metamodel
+issuingAgent : TravelAgent = TerrificTravel architecture
UML chapter in [Siegel 00]. +fare : Currency = 1050.00 pattern.
+tax : Currency = 57.56

Introduction to UML 25
Package Structure

.co n
o
<<metamodel>>

m
UML

nce si
ua er
Behavioral Model
Elements Management

w.n l V dependency
ww ia
Foundation
package
Tr

Introduction to UML 26
Relation to Other OMG Technologies

.co n
XML Metadata
Meta Object

o
Metadata Layer Interchange
Facility
(XMI) Facility

m
nce si
ua er
UML XML
Document Type

w.n l V
Definition
Specification Layer
OMG UML
UML
CORBAfacility
ww ia
Interface
Definition
r
Platform Domain
T
Technology Technology
profiles*** profiles***

UML Profiles for


Customization Layer UML Profile for
Business
CORBA
Domains
*** In process, not yet adopted

Introduction to UML 27
Structural Modeling
! What is structural modeling?

.co n
! Core concepts

o
m
Diagram tour

nce si
!

ua er
! When to model structure
!
w.n l V
Modeling tips
Example: Interface-based design
ww ia
!
Tr

Introduction to UML 28
What is structural modeling?
! Structural model: a view of an system

.co n
that emphasizes the structure of the

o
objects, including their classifiers,

m
nce si
relationships, attributes and operations.

ua er
w.n l V
ww ia
r
T

Introduction to UML 29
Structural Modeling: Core Elements

Construct Description Syntax

.co n
o
class a description of a set of objects

m
nce si
that share the same attributes,
operations, methods, relationships

ua er
and semantics.
interface a named set of operations that

w.n l V
«interface»
characterize the behavior of an
element.
ww ia
component a physical, replaceable part of a
r
system that packages
T
implementation and provides the
realization of a set of interfaces.
node a run-time physical object that
represents a computational
resource.

Introduction to UML 30
Structural Modeling: Core Elements (cont’d)

.co n
Construct Description Syntax

o
constraint¹ a semantic condition or restriction.

m
nce si
{constraint}

ua er
w.n l V
¹ An extension mechanism useful for specifying structural elements.
ww ia
r
T

Introduction to UML 31
Structural Modeling: Core Relationships
Construct Description Syntax

.co n
association a relationship between two or more

o
m
classifiers that involves connections

nce si
among their instances.

ua er
aggregation A special form of association that
specifies a whole-part relationship

w.n l V
between the aggregate (whole) and
the component part.
generalization a taxonomic relationship between a
ww ia
more general and a more specific
r
element.
T
dependency a relationship between two modeling
elements, in which a change to one
modeling element (the independent
element) will affect the other modeling
element (the dependent element).

Introduction to UML 32
Structural Modeling: Core Relationships (cont’d)

.co n
Construct Description Syntax

o
realization a relationship between a specification

m
nce si
and its implementation.

ua er
w.n l V
ww ia
r
T

Introduction to UML 33
Structural Diagram Tour
! Show the static structure of the model
the entities that exist (e.g., classes, interfaces,

.co n
!
components, nodes)

o
internal structure

m
!

nce si
! relationship to other entities

ua er
! Do not show
temporal information
w.n l V
!

! Kinds
static structural diagrams
ww ia
!
! class diagram
r
object diagram
T
!

! implementation diagrams
! component diagram
! deployment diagram

Introduction to UML 34
Static Structural Diagrams
! Shows a graph of classifier

.co n
elements connected by static

o
m
nce si
relationships.

ua er
! kinds

! w.n l V
class diagram: classifier view
ww ia
! object diagram: instance view
Tr

Introduction to UML 35
Classes

.co n
Window
{abstract,

o
Window author=Joe,

m
nce si
status=tested}
+size: Area = (100,100)

ua er
#visibility: Boolean = invisible
Window +default-size: Rectangle

w.n l V
#maximum-size: Rectangle
-xptr: XWindow*
size: Area
ww ia
visibility: Boolean
+display ()
r
+hide ()
display ()
T
hide () +create ()
-attachXWindow(xwin:Xwindow*)

Fig. 3-17, UML Notation Guide

Introduction to UML 36
Classes: compartments with names

.co n
Reservation

o
operations

m
nce si
guarantee()

ua er
cancel ()
change (newDate: Date)

w.n l V responsibilities
bill no-shows
ww ia
match to available rooms
r
exceptions
T
invalid credit card

Fig. 3-20, UML Notation Guide

Introduction to UML 37
Classes: method body

.co n
o
PoliceStation

m
nce si
alert ()

ua er
1 station

*
w.n l V
ww ia
BurglarAlarm
r
isTripped: Boolean = false
T
report () { if isTripped
then station.alert(self)}

Fig. 3-21, UML Notation Guide

Introduction to UML 38
Interfaces
Hashable

.co n
String
. ..

o
* HashTable
contents

m
nce si
isEqual(String):Boolean
hash():Integer
Comparable

ua er
. ..

w.n l V
ww ia «use»

«interface»
r
Comparable
T
isEqual(String):Boolean
hash():Integer

Fig. 3-24, UML Notation Guide

Introduction to UML 39
Associations
Job 1..∗

.co n
Company Person
employer employee

o
m
nce si
Job

ua er
boss
salary
0..1
worker ∗

w.n l V Manages
ww ia
r
T
Person

{X or}
Account
Corporation

Fig. 3-31, UML Notation Guide


Introduction to UML 40
Association Ends

.co n
+points

o
1 3..∗
Contains

m
nce si
Polygon Point
{ordered}

ua er
1

w.n l V 1
GraphicsBundle
ww ia
-bundle color
texture
r
density
T

Fig. 3-32, UML Notation Guide

Introduction to UML 41
Ternary Associations

.co n
Year

o
season ∗

m
nce si
ua er
∗ ∗
Team Player
goalkeeper

w.n l V
ww ia team
r
Record
T
goals for
goals against
wins
losses
ties
Fig. 3-31, UML Notation Guide

Introduction to UML 42
Composition
Window

.co n
o
scrollbar [2]: Slider

m
title: Header

nce si
body: Panel

ua er
w.n l V
Window
1
1 1
ww ia
scrollbar 2
r
title 1 body 1
T
Slider Header Panel

Fig. 3-36, UML Notation Guide

Introduction to UML 43
Composition

.co n
Window

o
m
nce si
ua er
2
scrollbar:Slider

w.n l V 1
ww ia
title:Header
Tr
1
body:Panel

Fig. 3-36, UML Notation Guide

Introduction to UML 44
Generalization
Shape

.co n
Separate Target Style

o
m
nce si
ua er
Polygon Ellipse Spline . ..

w.n l V
ww ia
Shape
Shared Target Style
Tr
...
Polygon Ellipse Spline

Fig. 3-38, UML Notation Guide


Introduction to UML 45
Generalization

.co n
Vehicle

o
power venue

m
nce si
power venue
{overlapping} {overlapping}

ua er
WindPowered MotorPowered Land Water
Vehicle
w.n l V
Vehicle Vehicle Vehicle
ww ia
r
T

Truck Sailboat

Fig. 3-39, UML Notation Guide

Introduction to UML 46
Dependencies

.co n
ClassA ClassB ClassD
«friend»

o
«friend»

m
nce si
operationZ()
«instantiate»

ua er
«call»

w.n l V
ClassC

«refine»
ww ia
ClassC combines
two logical classes
Tr
ClassD ClassE

Fig. 3-41, UML Notation Guide

Introduction to UML 47
Dependencies

.co n
o
Controller

m
nce si
«access»

ua er
«access»

w.n l V
«access» Diagram
Elements
«access»
ww ia
«access»
Tr
Domain Graphics
Elements Core

Fig. 3-42, UML Notation Guide

Introduction to UML 48
Objects

.co n
tria n g le : P olyg on tria ng le

o
m
nce si
c e n te r = (0 ,0 )
ve rtic e s = ( (0 ,0 ),(4 ,0) ,( 4,3 ))

ua er
bo rd e rC olo r = bla c k
fillC o lo r = wh ite
:P olyg on

w.n l V
ww ia
tria ng le : P o lyg o n
Tr
s c h e d u le r

Fig. 3-29, UML Notation Guide

Introduction to UML 49
Composite objects
awindow : Window

.co n
o
m
horizontalBar:ScrollBar

nce si
ua er
verticalBar:ScrollBar

w.n l V moves
ww ia
surface:Pane
moves
Tr
title:TitleBar

Fig. 3-30, UML Notation Guide

Introduction to UML 50
Links

.co n
officer

o
Jill:Person

m
nce si
member

ua er
treasurer
member

w.n l V
downhillSkiClub:Club
ww ia Joe:Person

president
member
r
Chris:Person
T
officer

Fig. 3-37, UML Notation Guide

Introduction to UML 51
Constraints and Comments
∗ Me m b e r-of ∗

.co n
P e rs o n {s ub s e t} Co m m itte e R e p re s e n ts

o
a n in c o rpo ra te d e n tity.

m
nce si
1 C h a ir-o f ∗

ua er

P e rs o n ∗ w.n l V
e m p lo ye e e m p loye r
0 .. 1 Co m pa ny
ww ia
0 .. 1
b os s
Tr
{P e rs o n. e m p loye r =
P e rs o n. bo s s .e m p lo ye r}

Fig. 3-15, UML Notation Guide

Introduction to UML 52
Implementation Diagrams
! Show aspects of model

.co n
implementation, including source

o
m
nce si
code structure and run-time

ua er
implementation structure
! Kinds w.n l V
ww ia
! component diagram
Tr
! deployment diagram

Introduction to UML 53
Component Diagram
! Shows the organizations and

.co n
dependencies among software

o
m
nce si
components

ua er
! Components include

! w.n l V
source code components
ww ia
! binary code components
Tr
! executable components

Introduction to UML 54
Components
Spell-check

.co n
Dictionary

o
Synonyms

m
nce si
ua er
w.n l V
ww ia
mymailer : Mailer
r
+RoutingList
T
+Mailbox

-MailQueue

Fig. 3-84, UML Notation Guide


Introduction to UML 55
Component Diagram

.co n
Scheduler Reservations

o
m
nce si
ua er
w.n l V
Planner Update
ww ia
r
T

GUI

Fig. 3-81, UML Notation Guide


Introduction to UML 56
Deployment Diagram
! Shows the configuration of run-time

.co n
processing elements and the software

o
m
components, processes and objects

nce si
ua er
that live on them
!
w.n l V
Deployment diagrams may be used to
show which components may run on
ww ia
r
which nodes
T

Introduction to UML 57
Deployment Diagram

.co n
Adm inS e rve r:H os t Ma c h ine

o
« d atab a s e»
m e e ting s D B

m
nce si
:S c h e du le r

ua er
re s e rva tio ns

w.n l V
ww ia
J o e ’s Ma c hin e : P C
Tr
:P la nn e r

Fig. 3-82, UML Notation Guide


Introduction to UML 58
Deployment Diagram (cont’d)

.co n
Node1

o
m
nce si
«database»
«cluster» w z

ua er
x y

w.n l V «become»
ww ia
Node2
r
«cluster»
T
x y

Fig. 3-83, UML Notation Guide


Introduction to UML 59
When to model structure
! Adopt an opportunistic top-down+bottom-up approach

.co n
to modeling structure

o
Specify the top-level structure using “architecturally significant”

m
!

nce si
classifiers and model management constructs (packages,
models, subsystems; see Tutorial 3)

ua er
! Specify lower-level structure as you discover detail re classifiers

w.n l V
and relationships
! If you understand your domain well you can frequently
ww ia
start with structural modeling; otherwise
If you start with use case modeling (as with a use-case driven
r
!
T
method) make sure that your structural model is consistent
with your use cases
! If you start with role modeling (as with a collaboration-driven
method) make sure that your structural model is consistent
with your collaborations

Introduction to UML 60
Structural Modeling Tips
! Define a “skeleton” (or “backbone”) that can be
extended and refined as you learn more about your

.co n
domain.

o
m
Focus on using basic constructs well; add advanced

nce si
!
constructs and/or notation only as required.

ua er
! Defer implementation concerns until late in the

!
modeling process.
w.n l V
Structural diagrams should
ww ia
! emphasize a particular aspect of the structural model
r
contain classifiers at the same level of abstraction
T
!

! Large numbers of classifiers should be organized into


packages (see Lecture 3)

Introduction to UML 61
Example: Interface-based design
module POS
{

.co n
typedef long POSId;

o
typedef string Barcode;

m
nce si
interface InputMedia

ua er
{

w.n l V
typedef string OperatorCmd;
void BarcodeInput(in Barcode Item);
void KeypadInput(in OperatorCmd Cmd);
ww ia
};
r
interface OutputMedia
T
{…..};
interface POSTerminal
{…..};
};
Ch. 26, CORBA Fundamentals and Programming (2nd ed.), [Siegel 00]

Introduction to UML 62
From Modeling CORBA Applications with UML chapter
in [Siegel 00].

Point-of-Sale
«IDLinterface» «IDLinterface»
IPOSterminal IinputMedia

.co n
+storeRef : Store +POSref : POSterminal
InputMedia +initialization()
+storeAccessRef : StoreAccess

o
+outputMediaRef : OutputMedia +barcodeInput()
+taxRef : Tax +keypadInput()

m
+POSid : Integer

nce si
+itemBarcode : Integer «IDLinterface»
+itemQuantity : Integer IOutputMedia
OutputMedia
+itemInfo : ItemInfo

ua er
+itemPrice : Currency «IDLinterface»
+outputText()
+itemTaxPrice : Currency IStore
+itemExtension : Currency
+saleSubtotal : Currency +totals : Totals

w.n l V
+taxableSubtotal : Currency +POSlist : List
+saleTotal : Currency +initialization()
+saleTax : Currency +login()
POSterminal
+POSlist : List +getPOStotals()
+initialization() +updateStoreTotals()
+login()
ww ia
+printPOSsalesSummary()
+printStoreSalesSummary()
+setItemQuantity()
r
+sendBarcode() Store
+endSale()
T
«IDLinterface»
«IDLinterface» IStoreAccess
ITax
+depotRef : Depot
Tax +rate : float +taxRef : Tax
+initialization() +storeMarkup : float
+calculateTax() StoreAccess +storeId : Integer
+findTaxablePrice() +initialization()
+findPrice()

Introduction to UML 63
Use Case Modeling
! What is use case modeling?

.co n
! Core concepts

o
m
Diagram tour

nce si
!

ua er
! When to model use cases
!
w.n l V
Modeling tips
Example: Online HR System
ww ia
!
Tr

Introduction to UML 64
What is use case modeling?
! use case model: a view of a system that

.co n
emphasizes the behavior as it appears

o
to outside users. A use case model

m
nce si
partitions system functionality into

ua er
transactions (‘use cases’) that are
w.n l V
meaningful to users (‘actors’).
ww ia
r
T

Introduction to UML 65
Use Case Modeling: Core Elements

Construct Description Syntax

.co n
o
use case A sequence of actions, including

m
nce si
variants, that a system (or other
UseCaseName
entity) can perform, interacting with

ua er
actors of the system.
actor A coherent set of roles that users

w.n l V
of use cases play when interacting
with these use cases.
ww ia
ActorName
r
system Represents the boundary between
T
boundary the physical system and the actors
who interact with the physical
system.

Introduction to UML 66
Use Case Modeling: Core Relationships

Construct Description Syntax

.co n
o
association The participation of an actor in a use

m
nce si
case. i.e., instance of an actor and
instances of a use case communicate

ua er
with each other.

w.n l V
extend A relationship from an extension use
case to a base use case, specifying
<<extend>>
how the behavior for the extension
ww ia
use case can be inserted into the
r
behavior defined for the base use
T
case.
generalization A taxonomic relationship between a
more general use case and a more
specific use case.

Introduction to UML 67
Use Case Modeling: Core Relationships (cont’d)

.co n
Construct Description Syntax

o
m
include An relationship from a base use case

nce si
to an inclusion use case, specifying <<include>>

ua er
how the behavior for the inclusion use
case is inserted into the behavior

w.n l V
defined for the base use case.
ww ia
r
T

Introduction to UML 68
Use Case Diagram Tour
! Shows use cases, actor and their

.co n
relationships

o
m
nce si
! Use case internals can be specified by

ua er
text and/or interaction diagrams (see
Lecture 2)
Kinds w.n l V
ww ia
!
use case diagram
r
!
T
! use case description

Introduction to UML 69
Use Case Diagram

.co n
Telep hon e Catalog

o
m
nce si
Che c k
s tatus

ua er
Place S ales pe rs o n

w.n l V
ww ia orde r

Fill orders
r
Cus tomer S hip pin g Cle rk
T
Es tablis h
c re dit

S upe rvis o r
Fig. 3-44, UML Notation Guide
Introduction to UML 70
Use Case Relationships

.co n
Supply Order

o
Customer Data Product Arrange

m
Payment

nce si
ua er
«include» «include» «include»

w.n l V
ww ia
Place Order
r
Extension points «extend»
T
1 * additional requests : the salesperson asks for
after creation of the order the catalog

Request
Catalog

Fig. 3-45, UML Notation Guide


Introduction to UML 71
Actor Relationships

.co n
Place

o
1 *

m
Order

nce si
Salesperson

ua er
w.n l V
ww ia
r
T
Establish
1 *
Credit
Supervisor
Fig. 3-46, UML Notation Guide
Introduction to UML 72
Use Case Description: Change Flight
■Actors: traveler, client account db, airline reservation system
■Preconditions:

.co n
• Traveler has logged on to the system and selected ‘change flight

o
itinerary’ option

m
nce si
■Basic course

ua er
• System retrieves traveler’s account and flight itinerary from client
account database

w.n l V
• System asks traveler to select itinerary segment she wants to
change; traveler selects itinerary segment.
• System asks traveler for new departure and destination
ww ia
information; traveler provides information.
• If flights are available then
Tr
• …
• System displays transaction summary.

■Alternative courses
• If no flights are available then …

Introduction to UML 73
When to model use cases
! Model user requirements with use cases.
Model test scenarios with use cases.

.co n
!

o
If you are using a use-case driven method

m
!

nce si
start with use cases and derive your structural and

ua er
!
behavioral models from it.
!
method w.n l V
If you are not using a use-case driven
ww ia
! make sure that your use cases are consistent with
r
your structural and behavioral models.
T

Introduction to UML 74
Use Case Modeling Tips
! Make sure that each use case describes a significant chunk of
system usage that is understandable by both domain experts

.co n
and programmers

o
! When defining use cases in text, use nouns and verbs

m
nce si
accurately and consistently to help derive objects and messages
for interaction diagrams (see Lecture 2)

ua er
! Factor out common usages that are required by multiple use

w.n l V
cases
! If the usage is required use <<include>>
If the base use case is complete and the usage may be optional,
ww ia
!
consider use <<extend>>
r
! A use case diagram should
T
! contain only use cases at the same level of abstraction
! include only actors who are required
! Large numbers of use cases should be organized into packages
(see Lecture 3)

Introduction to UML 75
Example: Online HR System

.co n
o
Online HR System

m
nce si
Locate
Employees

ua er
Update
Employee Manager
Profile

w.n l V
{if currentMonth = Oct.}
Update Benefits
ww ia
Employee Healthcare Plan System
r
Access Travel
{readOnly}
System
T
Access Pay Insurance Plan System
Records

Introduction to UML 76
Online HR System: Use Case Relationships

.co n
Update Medical Update Dental
Update
Plan Plan
Insurance Plan

o
m
nce si
<<include>> <<include>> <<include>>

ua er
w.n l V
Update Benefits
______________
Extension points extension point
benefit options: name and
ww ia
after required enrollments location
Employee
r
<<extend>> <<extend>>
T
employee requests employee requests
reimbursement option stock purchase option

Elect
Elect Stock
Reimbursement extension
Purchase
for Healthcare condition

Introduction to UML 77
Online HR System: Update Benefits Use Case

■Actors : employee, employee account db, healthcare plan system,

.co n
insurance plan system

o
■Preconditions:

m
nce si
•Employee has logged on to the system and selected ‘update benefits’
option

ua er
■Basic course

w.n l V
• System retrieves employee account from employee account db
•System asks employee to select medical plan type; include Update
Medical Plan.
ww ia
• System asks employee to select dental plan type; include Update
r
Dental Plan.
T
• …

■Alternative courses
• If health plan is not available in the employee’s area the employee is
informed and asked to select another plan...

Introduction to UML 78
Wrap Up
! Ideas to take away

.co n
! Preview of next tutorial

o
m
nce si
! References

ua er
! Further info
w.n l V
ww ia
r
T

Introduction to UML 79
Ideas to Take Away
! UML is effective for modeling large, complex software

.co n
systems

o
It is simple to learn for most developers, but provides

m
!

nce si
advanced features for expert analysts, designers and
architects

ua er
! It can specify systems in an implementation-

! w.n l V
independent manner
10-20% of the constructs are used 80-90% of the
ww ia
time
Structural modeling specifies a skeleton that can be
r
!
T
refined and extended with additional structure and
behavior
! Use case modeling specifies the functional
requirements of system in an object-oriented manner

Introduction to UML 80
Preview - Next Tutorial
! Behavioral Modeling with UML

.co n
! Behavioral modeling overview

o
m
Interactions

nce si
!

ua er
! Collaborations
!
w.n l V
Statecharts
Activity Graphs
ww ia
!
Tr

Introduction to UML 81
References
! OMG UML Specification v. 1.3, OMG doc# ad/06-08-

.co n
99

o
m
nce si
! [Kobryn 99] UML 2001: A Standardization Odyssey,

ua er
Communications of the ACM, Oct. 1999.
!
w.n l V
[Kobryn 00] “Modeling CORBA Applications with
UML,” chapter contribution to [Siegel 00] CORBA 3
ww ia
Fundamentals and Programming (2nd ed.), Wiley,
Tr
2000.

Introduction to UML 82
Further Info
! Web:
! UML 1.4 RTF: www.celigent.com/omg/umlrtf

.co n
! OMG UML Tutorials:

o
www.celigent.com/omg/umlrtf/tutorials.htm

m
nce si
! UML 2.0 Working Group:
www.celigent.com/omg/adptf/wgs/uml2wg.htm

ua er
! OMG UML Resources: www.omg.org/uml/
! Email
! w.n l V
uml-rtf@omg.org
ww ia
! ckobryn@acm.org
r
Conferences & workshops
T
!
! OMG UML Workshop: UML in the .com Enterprise, Palm
Springs, California, Nov. 2000
! UML World 2001, location and dates TBA
! UML 2001, Toronto, Canada, Oct. 2001

Introduction to UML 83

Вам также может понравиться