You are on page 1of 22

UML DiagramS

Types of UML Diagram


 Structural Diagrams
focus on static aspects of the software system Such as:

 Class Diagram  Object Diagram


 Package Diagram  Component Diagram
 Deployment Diagram: Describes the hardware used in system
 Behavioral Diagrams
 focus on dynamic aspects of the software system
Such as:
 Use-case Diagram  Activity Diagram
 State Chart Diagram  State machine Diagram
 Interaction Diagrams:
 emphasize on object interaction such as
 Sequence Diagram  Timing Diagram
1- Structure Diagrams
1- Class Diagram Example
Name Order class
-dateReceived
Multiplicity:
Attributes -isPrepaid mandatory Customer
-number :String
-price : Money
* 1 -Name
-address
+dispatch()
Operations +close()
Association +creditRating() : String()

1
{if Order.customer.creditRating is Generalization
"poor", then Order.isPrepaid must
be true }

Corporate Customer Personal Customer


-Name -creditCard#
Constraint -creditRating
-creditLimit
Multiplicity: (inside +remind() Class diagram:
Many value braces{}} +billForMonth(Integer)
describes a structure
0..1
Multiplicity: of the system (Model)
optional *
Employee
using their classes,
*
OrderLine attributes, and the
-quantity: Integer
-price: Money * 1
Product
relationships among
-isSatisfied: Boolean these classes.
2- Object Diagram Example
c : Company

s : Department rd : Department

name = “Sales” name = “R&D”

Object Diagram a snapshot of


uss : Department the objects in a system provide
a complete or partial view of
name = “US Sales”
the objects of Class Diagrams
and links among them at
manager specific time.
erin : Person

name = “Erin” : Contact-Infomation


employeeID = 4362
title = “VP of Sales” address = “1472 Miller St.”
Object diagram Vs Class diagram
 Class Diagram address the static design view of
the all system while object diagrams address the
dynamic design view or static process view of a
system.
3- Package Diagrams
 Package: is collection of logically related UML elements
(Usually: group of classes )
 Complex class diagrams is organized as group of classes
into set of packages.
 Packages appear as rectangles with small tabs at the
top.
Notation:
 The package name is on the tab
OR inside the rectangle.
 The dotted arrows mean
dependencies. One package
depends on another: a change in
one package forced the other one
to be changed.
2- UML Behavior Diagrams

 focus on dynamic aspects of the software system:


 Use-case Diagram

 State Chart Diagram

 Activity Diagram

 State machine Diagram


1- Use Case Diagrams
 Use case Diagram:
• a contract consists of a set of procedures between an
end user and software developers
• It describes the behavior of the system from an
external point of view.
 i.e. Use case is used for:
 Capturing user requirements
 Describing a set of user scenarios
 Description of how a system will be used.
 May be described in plain text.
Use Case Diagrams Components

 Actors: is a person, organization, or external system that


plays a role in one or more interactions with your system.
Actors are drawn as stick figures.
 Use cases. Scenario name describes an interaction
between a user (actor) and a system, including
alternatives and is drawn as a horizontal ellipse.
 communication. A connection between actors and use
cases when an actor is involved with an interaction
described by a use case. It is indicated by solid lines
 System boundary: rectangle diagram representing the
boundary between the actors and the system.
Example: Use Case Diagrams Components
Library System Use Case
Boundary
Borrow

Order Title
Employee
Actor Client
Fine Remittance Actor
Supervisor

E.g.The use case of “order title” receives orders


from employee or supervisor, then return the
ordered title.
Use Case Relations
Generalization: Relationship between one general use case and a
special use case(to define special alternatives)
base waiters employee

Include: dotted line labeled <<include>> begin from base use case
and end with an arrows pointing to the included use case
A Use Case may be included by one or more Use Cases, to reduces
the duplication of functionality.
<<include>>
base Modify order List orders

Extend: a dotted line labeled <<extend>> with an arrow end at the


base case. Used when exceptional circumstances are encountered.
<<extend>>
Get approval Modify order
base
The <get approval> Use Case may optionally extend the regular
<modify order> Use Case.
Example of Use Case Diagrams -4
Example of Use Case Diagrams -4
•Pay Bill: is a parent use case
Bill Insurance: is the child use
case. (generalization)

•Make Appointment base case


Request Medication base case
each of them include
Check Patient Record as a
subtask
•The extension point is
written inside the base case
Pay bill;
What we mean:
The extending class Defer
payment adds the behavior of
this extension point. (extend)
2- State Diagrams: (object states)
 State Diagrams show the possible states of the object
and the transitions that cause a change in state. i.e.
how incoming calls change the state
Notation
States are rounded rectangles
Initial and Final States indicated by circles as in the
Activity Diagram
Transitions are arrows from one state to another.
Events or conditions that trigger transitions are written
beside the arrows.
Final state terminates the action; may have multiple
final states
Start Unpaid Paid End
Invoice paying Invoice
created destroying
State Diagrams: Traffic light Example

Traffic Light Start


State
Transition Red

Yellow

Green

Event
3- UML Interaction Diagrams

 Sequence Diagram shows:


o How objects communicate with each other in terms of
a sequence of messages.
o the lifespans of objects relative to those messages
 Collaboration Diagram
Focus on structural organization of objects &messages
1- Sequence Diagram- object Interaction
• Demonstrate the objects behavior in use case by
describing the objects and the messages they pass.
 Represents dynamic behaviour of system

Symbols of Sequence
 Arrows represent messages Represent
object
 Simple messages

 Special message creating


object
 Special message
destroying object
 Message response
Sequence Diagrams – Object Life Spans
 Lifelines
The dotted line that extends down the vertical axis
from the base of each object.
A
 Activation bar
The long boxes on the lifelines are Create
method-invocation boxes indicating B

the processing is performed by the


target object to fulfill a message.
 Messages
Labeled arrows, with arrowhead
indicating the direction of the call. Return X
Deletion
 Deletion
 Placing an ‘X’ on lifeline Lifeline
 Object’s life ends at that point Activation bar
Example: Sequence Diagram(make a phone call)

Caller Phone Recipient

Picks up

Dial

Dial tone

Ring notification Ring

Picks up

Hello
2- Collaboration diagrams
•Shows the relationship between objects and the order of
messages passed between them.
•The objects are listed as rectangles and arrows indicate the
messages being passed 6: remove reservation
start
3 : [not available] reserve title
User Reservations
6 : borrow title
5: title available
1: look up

2: title data

4 : title returned
Catalog
5 : hold title

•The numbers before the messages are called sequence


numbers. They show the sequence of the messages as they are
passed between the objects.
•convey the same information as sequence diagrams, but
focus on object roles instead of the time sequence
UML Design Driven Process
Requirements Elicitation Analysis Specification Design Implementation

Use Case Sequence Deployment


Diagram Object Diagram Class Diagram State Chart
Diagram Diagram

Determine Identify Collaboration Identify Generalize


Activity
Requirements major Diagram major scenarios Diagram
of objects Class to describe
user/system and Create and behavior
relation- scenarios relation-
of usage ships Refine and add
ships
implementation
details 22

You might also like