Anda di halaman 1dari 30

A Brief Introduction to

UML

or
UML in an Hour
(more or less)
Copyright 2000 by RWD Technologies Inc.
All Rights Reserved
What is the UML?
✔ Unified Modeling Language
✔ It is a modeling language, not a process
✔ Rumbaugh joined Booch at Rational in 1994; in
1995, Rational added Jacobsen to their team. In
1996, work on the UML was begun.
✔ In January of 1997, Rational released UML 1.0 to
the OMG as their proposal for a methods
standard.

02/12/09 2
Objectives
✔ Upon successful completion of this
presentation, you will be able to:
– Visually identify UML diagrams.
– Understand the differences between the UML
diagrams.
– Identify key symbols found in each diagram.
– Identify the diagrams used in each ProVision
phase.

02/12/09 3
UML Diagrams to be Covered

✔ Class Diagrams
✔ Use Case Diagrams
✔ Collaboration Diagrams
✔ Sequence Diagrams
✔ Package Diagrams
✔ Component Diagrams
✔ Deployment Diagrams
✔ Activity Diagrams
✔ State Diagrams

02/12/09 4
Class Diagrams
✔ Are the most fundamental UML Diagram.
✔ Describe the classes in the system, and the
static relationships between classes.
✔ Class diagrams are used during Analysis,
Design and Development.

02/12/09 5
UML Class Diagram
Customer
1

Rental Invoice

Rental Item 1..*


{abstract}
1 0..1

1
Checkout Screen
DVD Movie VHS Movie Video Game

02/12/09 6
UML Class Diagram Multiplicity

Customer Simple
1
Class Aggregation

Abstract Rental Invoice


Class

Rental Item 1..*


{abstract}
1 0..1
Composition
Simple
Generalization (Dependency)
Association

Checkout Screen
DVD Movie VHS Movie Video Game

02/12/09 7
IDEF1X97 Class Diagram
Customer
Class Relationship

Rental Invoice
Dependent
class
Rental Item

Generalization
(cluster)
Multiplicity/
Base class Cardinality
is abstract Checkout Screen

DVD Movie VHS Movie Video Game

02/12/09 8
Parts of a Class
✔ Classes can have four parts
MyClassName

Name

Attributes +SomePublicAttribute : SomeType
-SomePrivateAttribute : SomeType

Operations #SomeProtectedAttribute : SomeType


Responsibilities +ClassMethodOne()
+ClassMethodTwo()
✔ Classes can show visibility
and types. Responsibilities
-- can optionally be described here.
✔ All parts but the Name are
optional.

02/12/09 9
Object Diagrams
✔ An Object is an instance of a
class. ThisOne : MyClassName

✔ Object names are underlined. +SomePublicAttribute : SomeType


✔ Object diagrams are similar to -SomePrivateAttribute : SomeType
#SomeProtectedAttribute : SomeType
class diagrams. Many of the
same notations are used. +ClassMethodOne()
+ClassMethodTwo()
✔ Object diagrams capture
instances of classes, and allow
the dynamic relationships to
be shown.

02/12/09 10
Class and Object Diagrams
Class Name Association Name

Customer Rental Item


+id:integer Rents 0..n +id:integer
+name:string +released:date
0..1

Class Diagram
Attributes
Object Name

Joe: Customer Casablanca: Movie


+id:1667 +id:22340
+name:Joe Smith +released:1942

Object Diagram

02/12/09 11
Stereotypes, Tagged Values and Constraints
✔ Stereotypes, Tagged
Tagged Value
Values and Constraints Stereotype
extend the UML
– Stereotypes are RentalContract

shown using <<>> <<persistent>>


{version=1.1}
– Tagged Values and
ListOfRentedItems
Constraints are Customer {ordered
shown using { } by title}

Constraint

02/12/09 12
Use Cases
✔ Describe interactions between users and
computer systems (both called actors) .
✔ Capture user-visible functions.
✔ Achieve discrete measurable goals.
✔ May be
– small (“Make selected text bold”)
– large (“Generate a table of contents”)
✔ Are typically used during Analysis and Design.

02/12/09 13
Use Case Diagram
Use Case
Actor

Identify Movie

Open Account
Customer Clerk

Return Movie

In-Store Telephone Review


Customer Customer Account Status

02/12/09 14
Use Case Report
✔ The Use Case Report ✔ Brief description
provides documentation ✔ Precondition
for the Use Case. ✔ Flow of events
✔ A Use Case is not – Main flow
complete without the – Subflows
– Alternate flows
report.
✔ Postcondition
✔ The elements of the Use
✔ Special Requirements
Case Report are shown ✔ Enclosures
on the right. – Diagrams
– Pictures of the UI

02/12/09 15
Extends and Includes Relationships
Dependency

«includes»
Find Item
by Title
Includes Search Movie
«includes» Database
Customer
Find Items
by Actor

Stereotype

Extends «extends»

Clerk Check In Assess


Movie Late Fees

02/12/09 16
Collaboration Diagrams
✔ Collaboration diagrams describe object
interactions organized around the objects and
their links to each other
✔ Focus on exchange of messages between objects
through their associations.
✔ Appears during Analysis phase
✔ Enhanced during Design phase

02/12/09 17
Collaboration Diagram - Rent Movie
:Rented Items

1: enter_customer() 5: add(customer, movies) Object


8: generateRentalTotal()
3: enter_movies()
7: print invoice() 2: IsValidCust(CustId)

:Check-out :Customer
Manager
:Clerk

4:GetMovieByBarcode()

:Inventory Message

02/12/09 18
Sequence Diagrams
✔ Can be “morphed” from Collaboration Diagrams.
✔ Describe interactions between objects arranged in time
sequence
✔ Focus on objects and classes involved in the scenario
and the sequence of messages exchanged
✔ Associated with use cases
✔ Used heavily during Analysis phase and are enhanced
and refined during Design phase

02/12/09 19
Sequence Diagram - Rent Movie
:CheckoutMgr Cust:Customer :Inventory :RentedItems
: Employee

1: find customer()
2: search (string)

3: enter movie() 4: search (string) Object

Message Activation
5: rent (movie)
6: add(Cust, item)

Lifeline
7: printInvoice() 8: generateRentalTotal()

02/12/09 20
Package Diagram
C le r k U s e r In te r fa c e

( to b u s in e s s
C u s to m e r D a ta « fa c a d e » s y s te m )
B u s in e s s
S y s te m
C lie n t

Class
R e n ta l S c re e n Package

02/12/09 21
Component Diagram
Component
« lib r a r y »
D B S e rv e r
In te rfa c e
( d b s v r . d ll)

« lib r a r y »
Interface
A p p lic a t io n
F ra m e w o rk
( a p p f r . d ll)
Dependency

« a p p lic a t io n »
V id e o
W o r k s ta tio n Note S u p p lie d b y
( v s t a t io n . e x e ) M ic r o s o f t

02/12/09 22
Deployment Diagram

Node
:S to re S e rv e r
Communication
Association
S e rv e r
P h o n e C le r k T e r m in a l DB
: C le r k C lie n t « T C P /IP »

S to re
C h e c k O u t T e r m in a l S e rv e r
: C le r k C lie n t « T C P /IP » App

02/12/09 23
Activity Diagram
Start State

Identify Action State


Caller

Obtain Name Decision


& Address
Open
Current Account?
Customer? [no] [no]

[yes]
[yes] End State

Create
Account

02/12/09 24
Swimlanes and Fork/Join Points
Customer Manager Walking Clerk
Identify
Movie Fork Point

Place
Order

Place
Order

Fill
Collect Order
Pay
Money

Pickup Deliver
Movie Movie Join Point

02/12/09 25
State Diagram
Guard

Event

Transition [m o r e v id e o s ]
/g e t n e x t v id e o
c u s to m e r a p p e a rs
V a lid a te [ a c c o u n t v a lid ] C h e c k -O u t Action
d o /c h e c k / g e t f ir s t v id e o d o /c h e c k -o u t
account v id e o

Activity [n o m o r e v id e o s ]

C h e c k -O u t
[a c c o u n t n o t C o m p le te
State v a lid ]

02/12/09 26
UML Diagram Usage
Development UML Diagrams
Phase
Analysis Use Cases, Class Diagrams, Activity
Diagrams, Collaboration Diagrams,
Sequence Diagrams
Design Class Diagrams, Collaboration
Diagrams, Sequence Diagrams, State
Diagrams, Component Diagrams
Deployment Diagrams
Development Collaboration Diagrams, Sequence
Diagrams, Class Diagrams, State
Diagrams, Component Diagrams,
Deployment Diagrams
Implementation Package Diagrams, Deployment
Diagrams

02/12/09 27
Conclusion
✔ UML is a robust notation that can express
information gathered throughout a project’s
lifecycle.
✔ Adopting standard use of UML can improve
communication between clients and
Information Systems Service Providers.
✔ UML can be used as an effective data modeling
tool as well as an object modeling tool.

02/12/09 28
Questions If I don’t know the
answer, maybe I can
make one up!

02/12/09 29
For more information…
Contact:
John T. Bell
RWD Technologies Inc.
10480 Little Patuxent Parkway
Columbia, MD 21044

Phone: 410-884-2453
email: jbell@rwd.com

http://www.rwd.com

02/12/09 30

Anda mungkin juga menyukai