You are on page 1of 140

UML

. 2014-2013




.

.
()
.
2

. 2014-2013

The Modeling

(
)Abstraction

. 2014-2013

1989 1994
. "
.

( Unified Modeling
) UML Language ..
" "
(.)Three Amigos

. 2014-2013

UML

:)Unified Modeling Language( UML


( .
artifacts .)UML

consortium UML
- ( )Hewlett-Packard
( )Microsoft (.)Oracle

UML ( )OMG 1979


( )OMG . UML
.

. 2014-2013

UML
UML -1

.
UML -2
.
-3
.
UML -4
OO Software

. 2014-2013

UML

UML
UML

UML

User Objects Layer

Model Layer
Meta Model Layer
Meta meta model layer

2014-2013 .

User Objects Layer

UML

2014-2013 .

User Objects Layer


Objects Layer

USE CASE Diagram

.1

CLASS Diagram

.2

Object Diagram

.3

ACTIVITY Diagram

.4

COLLABORATION Diagram

.5

STATE Diagram
SEQUENCE Diagram
Diagram

COMPONENT

.6
.7

Diagram-

.8

packaging
DEPLOYMENT Diagram

2014-2013 .

.9

UML Components

UML

Model
UML Model

2014-2013 .

10

UML
-1 )(Class Diagram
-2 (Use Case
)Diagram

" .1 -
"static class structure
" .2 "

-3 )(State Diagram
-4 )(Activity Diagram

relation of actors to system functions

.3 "
states of objects in a particular class

.4
sequential flow of activities

-5 )(Sequence Diagram

" .5
message passing structure

-6 " .6 (Collaboration
)Diagram
Context
-7 )" .7 (Components Diagram code
structure
-8 )(Package Diagram
" .8 "

(Deployment
"
-9 )Diagram
mapping of software to hardware

11

. 2014-2013

11

UML


Object Oriented

12

Object Oriented
.Functional (structural )programming
Attributes Behavior
)Methods) .Classes
create/ instances of class
: objects

(
) .methods
Encapsulated .

. 2014-2013

Behavioral
-use case
view
Structurestatic

Behavioral
diagramDynamic

InteractionDynamic

Physicalimpleme
ntation

USE CASE Diagram


CLASS Diagram

Object Diagram
STATE Diagram
ACTIVITY Diagram
COLLABORATION Diagram
SEQUENCE Diagram
COMPONENT Diagram
packaging Diagram
DEPLOYMENT Diagram
2014-2013 .

.1
.2

.3
.4
.5
.6
.7
.8

.9

13

UML Views and Diagrams


UML 4 (- )Views
static view .1

Structure Diagram .
- ( )class diagram
classes Relationships Object
diagram

-use case view .2 Behavioral Diagram

()
. .
( )use case diagram
.
14

. 2014-2013

14

UML Views and Diagrams


UML 4 ()
dynamic view .3 :
.
:
.1 Behavioral Diagram state
diagram (activity diagram
.2 :interaction diagram- sequence
collaboration-

Physical implementation view .4


:
.

15

Component & Deployment Structural


Diagram

. 2014-2013

15

UML Views and Diagrams


4 ()
Physical Diagrams .4

Structure Diagram-


- Component Diagram :
.
Modules Dependencies
.
: : Deployment Diagram
Nodes ) HW ( ( Connections
)TCP/IP

16

. 2014-2013

16

UML Views and Diagrams


UML (Views)
static view .1

.
( )class diagram

Object diagram

use case view .2



. ( )use case diagram
.

dynamic view .3

. ( )state diagram )(activity diagram
).(interaction diagram

.4

Physical implementation View :



. Component & Deployment Structural Diagram

17

. 2014-2013

17

18

. 2014-2013

18

use case View


Behavioral Diagram UCD USE CASE Diagram

.1

actors

use Cases

19

.
.
(
) ()

.
Use cases .
.

.

. 2014-2013

- The Use Case


)Diagram(UCD

Use Case
:

20

.
actor ( ).
system boundary ,
Use Cases actors
Use Cases
Use case diagram Scenarios
.
.

. 2014-2013

Use case diagram symbols


Actor

Relationships

Use case

System

2014-2013 .

21

The Use Case Diagram

22

. 2014-2013

Components of Use-Case Diagram


actor
association super class

.
: Association Actor

.
.
extension use case .base use case
generalization
specialized use case base
.usecase
23

. 2014-2013

The Use Case Diagram


UCD notations

FAST

24

. 2014-2013

The Use
Case Description UC

:
:

FAST .
main actors

sub-actors
FAST
pre conditions


post condition
FAST
scenario flow


Results

25

. 2014-2013

The Use Case Diagram Actors


26

. 2014-2013

Use Case
Description
use case Name :
Actor :
: Pre-conditions
: Post-conditions
: - Purpose
Description:
1.
2.

..............
Alternative courses:

3.

Errors:

27

. 2014-2013

ATM- Withdraw From Current ()


use case Name : Withdraw From Current
Actor : Client
: User already logged-in Pre-conditions
A menu is active with withdraw
: Amount is deducted from users account Post-conditions

: - Purpose
Description:
(1) Client initiates this usecase by selecting withdraw

)(2) System get all the accounts (use case get Account

(3) System displays all the accounts and prompts to select any one

(3) Client selects one account
(4) System prompts for the amount
(5) Client indicate an amount
(6) System issues money, update record, and confirms

Alternative courses:
(3) & (4) System selects the only one available account 4& 3

(6) requested amount is bigger than balance, system display message

Errors:
28

?Issue Cash

. 2014-2013

Use Case Diagram


29

. 2014-2013

- Registration Sys

30

. 2014-2013

Use-case diagram for a university registration system



31


. 2014-2013

The Use-Case Diagram for Appointment


System

2014-2013 .

32

Use case with Extends and Includes

2014-2013 .

33

Use Case Diagrams(cont.)

(TogetherSoft, Inc)

2014-2013 .

34

Use case for camera sys







high-level
use case,
"Take
picture".





35

. 2014-2013

36

. 2014-2013


Rank
Supplier

extend

Search
Product

include

View Product
Details
After page generation

Navigate
Deals

extend

include

extend

Customer
Checkout

Add to
cart

include
extend
user is not
a member

Login
Handle Order
Status

Write
Review

Register

include

-2013

Introduction | 2014
Diagrams
| Writing
| .Guidelines

37

UML Diagrams-static modeling


.1

.2

38

Static view
.

:
.1

Class Diagram - Structural Diagrams

.2

Object diagram Structural Diagrams

. 2014-2013

- UML Diagrams -static modeling


.1

Structural Diagrams CLASS Diagram


. Classes
Class diagram Classes
associations
- Classes

: Class television
class

39

class name
attributes
operations
Methods

. 2014-2013

An example of Class

Name

Account_Name
- Customer_Name
- Balance
+addFunds( )
+withDraw( )
+transfer( )

Attributes
Operations

2014-2013 .

40

An example of Class

41

. 2014-2013

UML Diagrams -static modeling


CLASS Diagram

CONTENT (methods,
Classes

Class Structure
attributes )
Objects

containment
Associations

Inheritance

CLASS Diagram -

2014-2013 .

42

CLASS Diagram

43

. 2014-2013

44

. 2014-2013

CLASS Diagram elearning sys

45

. 2014-2013

CLASS Diagram


46

. 2014-2013

Associations CLASS Diagram


47

. 2014-2013

-Relationships
)(Dependency
)(Generalization
) (Association
)(Aggregation

)(Composition

)(Multiplicity

)(Interfaces

2014-2013 .

48

(Association 1)
()
classes


Association Name
Association

University

Works for
Employer

Employee

Role Names
49

Professor

. 2014-2013

Class

)(Association 2

Association Name
Association

Manager

Manages of
manager

Class

Department

managed

Role Names

2014-2013 .

50

() Association 3


Factory
creates
Product

51

. 2014-2013

Link

52

Link : (Objects )
Classes

. 2014-2013

( Aggregation 1)
Aggregation Association
) (Whole-Part Class
Sub class


super -Class

53

. 2014-2013

( Aggregation 1)
Aggregation

Part

Wheel

Car

Part

54

. 2014-2013

Motor

Whole

() Aggregation 2
Aggregation -

55

. 2014-2013

( Composition 1)
Composition Aggregation
Ownership


.
- class - class

56

. 2014-2013

( Composition 1)
Composition
() ( )

Whole

Part
Schedule

Student

Composition

57

. 2014-2013

() Composition 2
Composition
( /)
Part

Transactions

Bank Account

Whole

CustomerInfo
Part



58

. 2014-2013

( Composition 3)
Composition Slider, header, panel

( )

59

. 2014-2013

( Dependency 1)
Class .

independent class
(A
A Class B B) Class
) (Method A B .
The dependent class
The independent class

Dependency
Relationship

System

Form
)display(Form f

) display(Form - (System) Class


) (Form
60

. 2014-2013

) (Dependency 2
The dependent class
Cart

Dependency
Relationship

The independent class


Product

add(Product p)

( Cart) add(Product)
( Product)

2014-2013 .

61

(Multiplicity 1)
Multiplicity

1
*0..

Unspecified
Exactly one

)Zero or more (many, unlimited

*
*1..
One or more
0..1
Zero or one
2..4
Specified range
2, 4..6
Multiple, disjoint ranges

62

. 2014-2013

(Multiplicity 2)

" "
"

0..4

0, 1
63

. 2014-2013

)(Multiplicity 3
House

Student

1 has

1 takes

0, 1

0, 1

2014-2013 .

Chimney

Payment

64

roles
multiplicities

Multiplicity notation:
0 0..10 10
1, 2
1 2
*

65

. 2014-2013

Association Class

66

. 2014-2013

)Association Class (2

67

. 2014-2013

( Generalization)
Inherited( )Class Class
/ Is-a-kind-of
Inherited ) (Subclass
)(Super-classes

Subclass Inherited Attributes Behavior-


method () .Super-class
Subclass :
.Specialized
() ( () Super-
class )
.
class . base class or root

class
leaf class
68

. 2014-2013

Example: Single Inheritance


Inherited Class

If a class has exactly one parent, it has single inheritance.

GroundVehicle
Superclass
(parent)

weight
licenseNumber

owner
0..*

Person

register( )

generalization

Subclass

Car

size

Truck
Tonnage

Trailer

getTax( )

2014-2013 .

69

Example: Multiple Inheritance

If a class has more than one parent, it has multiple inheritance


FlyingThing

Animal

multiple
inheritance

Airplane

UML

Helicopter

Bird

2014-2013 .

Wolf

Horse

70

Class diagram -
- Class Diagram

- Class Diagram objectoriented design


-
-
( .)Conceptual Model

Class Diagram -

Class diagram use case diagram Conceptual Model


Requirements analysis
71

. 2014-2013

Class diagram

.
Classes -
Classes

72

. 2014-2013

Class diagram

Classes Classes
.
- Classes"
Associations Multiplicity :
1 .
.

.
- Classes
.
.

.
73

. 2014-2013

Class Diagram 1:

74

. 2014-2013

Class Diagram 2:
RegistrationForm

ScheduleAlgorithm
RegistrationManager

0..*

1
addStudent(Course, StudentInfo)
1

Course
name
0..*numberCredits
open()

Student

1
3..10

1..*

Professor
4
1

CourseOffering

location
0..4
open()
addStudent(StudentInfo)
2014-2013 .

75

Class Diagram 3:
Multiplicity
Class

Customer 1

Abstract

Aggregation

Rental Invoice

0..*

Class
Rental Item 1..*

Generalization

DVD Movie

VHS Movie

Video Game

2014-2013 .

76

Class Diagram

UML classes are


analogous to E-R entities

2014-2013 .

77

Class Diagram of e-shopping system


78

. 2014-2013

Class Diagram ER Diagram


ER .
UML object oriented
.
Class Diagram UML

Association Class Diagram ER Diagram
) (Generalization IS-A ER Diagram
UML Model.
aggregation Contains
.aggregation
ER
Window

Window

window-ID
size
visibility

size
visibility
)(display

79

. 2014-2013

)(hide

Object Diagram
) : (Object )(Class
:Object Diagram Class Diagram

:Object Diagram
Class Diagram

:Object Diagrams ) (Snapshot


.
ThisOne : MyClassName
+SomePublicAttribute : SomeType
-SomePrivateAttribute : SomeType
#SomeProtectedAttribute : SomeType
)(+ClassMethodOne
)(+ClassMethodTwo
80

. 2014-2013

Class and Object Diagrams 1


Association Name

Class Name

Customer

Rental Item

Rents

+id:integer
+name:string

0..1

0..n +id:integer
+released:date

Class Diagram
Attributes
Object Name

Link Name

Aly: Customer
+id:1667
+name: Aly ahmed

UML: Rental Item


Rents

+id:22340
+released:1942

Object Diagram
2014-2013 .

81

Class and Object Diagrams 2

2014-2013 .

82

Object Diagrams

2014-2013 .

83

Interaction modeling-

.1

.2

84

Dynamic view
Conditions Interaction
flow Event flow information flow
:
- Interaction modeling

Sequence Diagram

Collaboration Diagram

Behavioral models

( )state diagram

)(activity diagram

. 2014-2013

UML Diagrams
Interaction modeling-

Interaction Diagrams
objects .

Interaction Diagrams
.
state diagram.
Sequence Diagram

Objects
Time
Objects

85

. 2014-2013

UML Diagrams
Interaction modeling-

86

Sequence Diagram
Collaboration Diagram

Interaction context
Messages
Time
.
sequence diagrams

collaboration diagrams
objects use case

. 2014-2013

UML Diagrams
Interaction modeling-

87

sequence diagrams
.
collaboration diagrams
. .
Sequence diagrams objects
use case objects .
.

. 2014-2013

Sequence Diagram(make a phone call)


Caller

Phone

Recipient

Picks up

Dial tone
Dial
Ring notification

Ring
Picks up
Hello

2014-2013 .

88

Sequence Diagram

89

. 2014-2013

Sequence

Diagram

2014-2013 .

90

Sequence
Diagram

91

. 2014-2013

Sequence Diagram

User

Message

Catalog

Reservations

1: look up ()
2: title data ()
3: [not available] reserve title ()

4 : title returned ()

5: hold title ()
5 : title available ()
6 : borrow title ()

6 : remove reservation ()

2014-2013 .

92

UML Diagrams
Interaction modeling-
Collaboration Diagram

.2

OO
.Object collaboration

93

( )Context
.
UML .

. 2014-2013


Collaboration Diagrams

94

. 2014-2013

The

The
Collaboration Diagrams

95

. 2014-2013

INTERACTION DIAGRAMS: COLLABORATION DIAGRAMS

start
6: remove reservation
3 : [not available] reserve title
User

Reservations

5: title available

6 : borrow title
1: look up
2: title data

4 : title returned
Catalog

2014-2013 .

96

5 : hold title

The Collaboration Diagrams

97

. 2014-2013

UML DiagramsDynamic view

STATE Diagram

.3

Triggers

98

.

: .
-
""
"" ( !).
. 2014-2013

State Diagrams
(Traffic light example)


Traffic Light

Start

State

Transition

Red
Yellow

Green
Event
2014-2013 .

99

UML Diagrams- Dynamic view


STATE Diagram

.3

- -

.

100

Behavioral Diagram

UML
.
. 2014-2013

STATE
Diagram

101

. 2014-2013

STATE Diagram

102

. 2014-2013

Microwave oven model

2014-2013 .

103

State Chart Diagram

2014-2013 .

104

105

. 2014-2013

State Diagrams
(Billing Example)
State Diagrams show the sequences of states an object goes through during its life
cycle in response to stimuli, together with its responses and actions; an abstraction
of all possible behaviors.

End

Start
Unpaid
Invoice created

Paid
paying

2014-2013 .

Invoice destroying

106

UML Diagrams- Dynamic view


Behavioral

ACTIVITY

Diagram

.4

Diagram

2014-2013 .

107

( )

108

. 2014-2013

ACTIVITY Diagram

2014-2013 .

109

ACTIVITY Diagram

2014-2013 .

110

Activity Diagram

111

. 2014-2013

shopping Activity diagram for online


112

. 2014-2013

-physical Diagrams.1

COMPONENT Diagram
package diagram

113

Packaging
.Diagram
(
headers )packages

. 2014-2013

-physical DiagramsDiagrams COMPONENT Diagram

.1

Structural

(
)) exe,obj,c,dll
.

114

. 2014-2013

COMPONENT Diagram

.7

2014-2013 .

115

COMPONENT Diagram
packaging Diagram

2014-2013 .

116

COMPONENT Diagram
Structural

.7

2014-2013 .

117

118

Package Diagrams

" "chunks
.
Package Diagrams UML
.
Package Diagrams

classes, data
entities, or use cases.

. 2014-2013

Package Diagrams

figure 1. Package diagram organizing the university class model.



Java Infrastructure packages seminar registration ,

Data entities package diagram .

Contact
point

2014-2013 .

119


class model -Package Diagrams
figure 1. Package diagram organizing the university class model.
Schedule

120

. 2014-2013


use case model -Package Diagrams
figure 1. Package diagram organizing the university class model.

121

. 2014-2013

-
Package Diagrams

122

2014
2010
-2013

..

Class diagram
for ordering system

123

. 2014-2013

- Package
Diagrams

124

2014
2010
-2013

..

3 -
Package class Diagrams

125

2014
2010
-2013

..

physical DiagramsDEPLOYMENT Diagram- -

.2

Diagrams

Structural

:
.

126

. 2014-2013

DEPLOYMENT Diagram

2014-2013 .

127

DEPLOYMENT Diagram

2014-2013 .

128

DEPLOYMENT
Diagram

2014-2013 .

129

DEPLOYMENT Diagram for


web network

2014-2013 .

130

DEPLOYMENT Diagram

2014-2013 .

131

UML
Use case Diagram ATM

132

. 2014-2013

UML
ATM State chart-Diagram

133

. 2014-2013

Package Diagram for Example ATM System


ATM

2014-2013 .

134

Class Diagram for ATM System:

2014-2013 .

135

UML
collaboration Diagram ATM

136

. 2014-2013

UML
component Diagram ATM

137

. 2014-2013


DEPLOYMENT Diagram for ATM.

138

. 2014-2013

Key points

139

UML .
" -Use Cases
"
" -Class Diagram
"
" -Collaboration Diagram
"
" - Sequence Diagram
"
. 2014-2013

Key points
hung up

140

" - State Diagram


" -Package Diagram

" - Component Diagram


" -Deployment Diagram


"
. 2014-2013

You might also like