What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

56
1 What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002 Akira KUMAGAI PFU LIMITED, Japan [email protected]. com

description

What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002. Akira KUMAGAI PFU LIMITED, Japan [email protected]. Contents. What’s UML UML Diagrams Stepwise understanding of UML UML Semantics Examples of Meta-model and OCL UML in the future Summary. What’s UML. - PowerPoint PPT Presentation

Transcript of What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Page 1: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

1

What is UML ?

ISFST2002 Tutorial in X’ianOctober 21, 2002

Akira KUMAGAI

PFU LIMITED, Japan

[email protected]

Page 2: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

2

Contents• What’s UML  • UML Diagrams• Stepwise understanding of UML• UML Semantics• Examples of Meta-model and OCL• UML in the future• Summary

Page 3: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 3

What’s UML

• How to integrate UML

• UML’s Issues as a Design Language

• Origins of UML

• Goals of UML

• UML and Applicable Application

• Why Defact Standard ?

Page 4: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 4Booch ´91

Booch ´93

Unified Method 0.8

UML 1.0

OMT - 2

OMT - 1 OOSE

UML 0.9 & 0.91

OOPSLA ´95

´96.1 & ´96.10

´97.12 OMG Standard

Other methods

feedback

´96.121.0 Open

UML Partnres

UML 1.1

UML 1.3

UML 1.4

UML 2.0

commercial

standardize

integration

chaotic

How to Integrate UML

Page 5: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 5

UML Issues

• Unify Booch, OMT, OOSE(Objectory)• Meta-Model : Key concept of modeling• Contribute Software Development

– Large Scale System Development

– Java, C++, Smalltalk, Ada, VB, PB, ...

– Distributed and Parallel 、 Multi-threads

– Design Pattern

– Componentware

– Business modeling

• More simpler

Page 6: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 6

UML

BoochRumbaugh

MeyerPre/Post condition

Harel

Gamma, et.al

Framework、Pattern、 Note

Statechart

Shlaer - Mellor

Object LifeCycle

OdellDynamics ClassificationMultiple Classification

Wirfs-Brockresponnsibility

EmbleySingleton classhigh level view

Fusion

Description of system operationnumbering messages

Jacobson

Origins of UML

Page 7: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 7

Goals of UML• Unify the software development methodologies

– Extension of Booch 、 OMT , Objectory– Integration of Traditional Notations and Diagrams

• Notations and Specifications Opened– OMG,Defact Standard– Extension and Customization with Stereo-type

• Applicable to the real world– Consistent representation through Requirement, Analy

sis, Design and Test– Large scale system development– Notations for the standard OO development processes

Page 8: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 8

UML from Development Process

• Redesign based on 2nd Generation methodology– Integration using Meta-Model– Collect good features from the existing methodologies

• For the large scale systems– Package and its Hierarchy, Interface Concept

• Structure and Function/Behabior– Objects(Structure and Behavior), Components– Use Case(External Functions), Patterns

• Power to support all Development Processes– Represent Architectures(4+1 Views)

Page 9: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 9

Unify ? What ?

• Many existing methodologies– Integration of Modeling Notations

• Many Application Domains– Integration of Specification Description and System

Description Styles

• Integration of Components that are the result of Software Development and Entities of models

• But, not to Unify Development Processes

Page 10: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 10

Scope of UML

• Business Modeling• Requirement Definitions• Domain Analysis• Architecture Definitions• Design• Represent of Implementations(Reverse model)• Modeling of objects to be tested• Modeling of Objects to be managed• etc….

Page 11: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 11

Out of the Scope of UML• Business:Strategies, planning, Intension• Requirement:Semantics definitions, management of

requirements, Risk,..• Architecture:Constrains among diagrams,...• Design:Policy, Time constrains, Usability, ..• Implementations:Program codes, …• Test:Plan, Test Cases, Test Scripts• Configuration and Version Management• Free hand sketches on the white board• Flexible interaction feeling with Break Downs

Page 12: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

What's UML 12

Why UML becomed de-fact ?

• Good timing after methodology’s war• Good collections from the practices• Great three Amigo

– Booch, Yacobson, Runbaugh

• Rational Software– Good support

• Semantics definitions sacrificing rigorous • Make up a powerful community• Easy to introduce it at first,,,,

Page 13: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 13

Contents : UML Diagrams

• Diagrams– take a look of 10 diagrams

• Relationships between Diagrams

Page 14: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 14

UML Diagrams

Definition Viewpoint Diagram nameRequirement Requirements Use CaseStructure Static Structure Class, Object,

PackageBehavior Dynamic

BehaviorSequence,CollaborationActivitiesState Chart

Implementation PhysicalImplementation

ComponentDeployment

Page 15: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 15

Requirement Diagram

• Use Case– to represent system functional capabilities from

the users’ viewpoint

Page 16: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 16

System

Manager

OrderReceiver

StockKeeper

Order Products

Control Stocks

Manage Customers

Manage ProductInformation

Use Case Diagram

Page 17: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagramsa 17

Structure Diagrams

• Class Diagram– Static Structures of Classes

• Object Diagram– Snapshot of the Class, that’s the relationship

among Instances

• Package Diagram– Special Cases of the Class

Page 18: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 18

Customer nameaddresstelphone

OrderOrder No.Order Date

Total no.Deliver PlanDeliver date

0..*

+OrderCustomer

1

Product ID

TitlegenrePrice

Detailamount

subtotal

1..* +Detaillist

+OrderProduct

1

CDArtist name

GameSoftwareDevice name

Video Direct

orHero

1..*

1

0..*

Class Diagram

Page 19: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 19

Sato-san : Customer

: Order

:Item Blade Runner: Video

: Item Imagine : CD

Object Diagram

Page 20: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 20

Sales Management Product Management

Inventory Control

Package Diagram

Page 21: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 21

UML Diagrams

• Behavior Diagrams– Interaction Diagram:Sequence, Collaboration

• Collaborations among Objects

– Activity Diagram• Flow of Jobs and Processes

– State Chart Diagrams• State Transitions of Objects in the Life Cycle

Page 22: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 22

Sequence Diagram

: Receive&Order

: Inout orders : Products Inventory

: ReceivingManager

: Order : Inventory Manager

Input Orders

Entry orders

Confirm stocksStock:= Confirm stocks

Stock:= Confirm stocks

Check goods stock

<<create>>

Set up Data

Entry ordersCheck goods stock

Page 23: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 23

Collaboration Diagram

: Receive&Order

: Order Entry

: Receiving Manager

: Inventory Manager

: Orders

1: Input Orders2: Confirm goods stock

5: [Stock]Register Orders 3: No Stock := Check Stocks

6: Register Orders

9: <<create>>10: Set up Data

4: Stock := Check stocks

8: Apply Stocks

7: Apply Stocks

: Goods Stocks

:Goods stock

Page 24: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 24

Activity Diagram

Deliver

Check Goods Stock

Receive Ordersける

Send bills

End of Receiving

Check Deliver Goods

Check Payment

AccountingSalesInventory Center

Page 25: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 25

State-chart Diagram

Pre-ReceivingOrder Entry

Apply stock[ Stock shortage ]

Receiving Confirmation

未納品

納品完了

未入金

入金完了

Not Deliver

Deliver[Absence]

End of deliver

---------------------------------------------

Deliver[ get signature ]

No Payment

End of Payment

Payment Date[ Payment ]

Payment Date[No payment ]

Cancel[ not deliver ]

Apply stocks[stocks] / deliver

Cancel

Page 26: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 26

Implementation Diagram

• Component Diagram– Software Physical Structure– Dependence relationships among Software

Modules

• Deployment Diagram– Deployment structures of Components and

Objects – Interfaces among Nodes

Page 27: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 27

Component Diagram

OrderWi n<<Package Speci fi cat i on>>

OrderMgr<<Package Speci fi cat i on>>

Order<<Package Speci fi cat i on>>

I nventryMgr<<Package Speci fi cat i on>>

I nvent ry<<Package Speci fi cat i on>>

Page 28: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 28

Deployment Diagram

: CacheRegister

: Bar Code Reader

: Product Mngmnt System

<<USB>>

<<TCP/IP>>

Page 29: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 29

Enough to Understand it ?

• What’s Meaning ?– Meaning of Icons to use– To share meanings with other people– To understand the invariant and the variant part

• Relationships among many Diagrams ?

Page 30: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 30

Sequence and Collaboration• Interaction Diagram

– Sequence Diagram

– Collaboration Diagram

a b c

m1

m2

m3m4

m5

a

bc

4: m4

5: m5

6:

1: m13: m3

7: 2: m2

Page 31: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 31

Sequence and State-Chart

• Objects Lifecycle– State-chart Diagram

– State Transition and Action by Events

S1

S2

S3

<<create>>

<<destroy>>

Input Event aInput Evebt b

Input Event c

do Activity1

do Activity2

do Activity3

Output Event pOutput Event q

Output Event r

Output Event s

Output Event t

Action opX

Action opY

a01:ClassA c1:ClassCb11:ClassB

Page 32: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 32

State-Chat Diagram and Component Specification

• Protocol of Object Behavior– Input Event and Output Event of Action

S1

S2

S3

<<create>>

<<destroy>>

Input Evebt aInput Event b

Input Event c

doActivity1

do Activity2

do Activity3

Output Event pOutput Event q

Output Event r

Output Event s

Output Event t

Action opX

Action opY

a01:ClassA

Page 33: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 33

Objects Interaction and Objects Lifecycle

S1

S2do/ send m1()

S3

e1

obj1

obj2

e1(self )

obj5obj3

obj4

m1()

e2/send m2(obj1)

e2

m2(obj1)

m3()

m4()

Page 34: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 34

Usecase and Collaborations

• Realization relationships between Use case and Collaborations

Usecase X

Collaboration XC1

Collaboration XC2

Page 35: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Diagrams 35

Collaboration and MVC Pattern• Collaboration as Usecase implementation : MVC a

rchitecture and Robustness analysis– View:Boundary obj/ an Actor– Control:Controller obj/ a collaboration – Entity obj as Domain knowledge representation

Model

ControlViewActor

SystemEnvironment

Page 36: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 36

Stepwise Understanding UML

• Model Elements

• Relationships

• Common mechanism

• Diagram

• Multiple Views of Architectures

Page 37: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 37

Model Elements

Class/Object Interface

Collaboration Use case

Process/Shred Component

Interaction State machine

Node Package

Note

Page 38: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 38

UML Basic TermsUML

Things Relationships Diagrams

Structure Behavior Group Annotation

Use CaseClassRollData TypeActive ClassInterfaceComponentsCollaborationNodeEvent

InteractionState- machineActionActivity

PackageModelSubsystem

Note

DependencyAssociationGeneralizationFlowRealization

Use CaseClassObjectSequenceCollaborationState ChartActivityComponentDeployment

Page 39: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 39

Structural Model ElementsStructural Model Elements• Class

– A set of Objects that have common structure and behavior

• Interface– External opened operations of objects

• Collaboration– Collaboration among object groups

• Use Case– Named system behaviors that be implemented

by Collaborations

Page 40: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 40

Structural Model ElementsStructural Model Elements• Active Class

– Active Classes with Process/Shred– Parallel with other Classes

• Component– Reusable parts that are logical and physical

• Node– Abstraction of hardware devices that software

components deploy and work on

Page 41: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 41

Behavior Model Elements

• Interaction– Message passing among Objects and Trigger of

State transitions

• State Machine– Action/Activity of Object Lifecycle

msg

Page 42: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 42

Group and Annotation Model Elements

Group and Annotation Model Elements

• Package– Container of Model Elements

• Note– Text description units of Comments,

Explanations, Annotations and etc...

Page 43: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 43

RelationshipsRelationships• Association

Semantic relationships between the two instances

• Generalization Relationships between model elements and its sub-

model elements (inheritance)

• Dependency Use other model elements

• Realization Relationships between Requirements, Specification,

Definition and Implementation, methods

r1 r2R

Page 44: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 44

Semantics Rules of UML

• Name:name of the element

• Scope:Context in case of naming

• Visibility:way of using names– to be able to see and use or not

• Integration:to integrate with other elements

• Run:Meaning of the result of the executable models

Page 45: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 45

Common UML Mechanism

• Binary Classification– Class - Object

• Deference between Type and Instance

– Interface - Implementation

• Extension Mechanism– Stereotype <<Keyword>>– Tagged Value ( Property name = Value )– Constrains {satisfied condition , proposition}

Page 46: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 46

UML Diagram Composition

• Structure Diagram– Class Diagram (including Package diagram)

– Object Diagram

• Behavior Diagram– Use case Diagram

– Sequence Diagram

– Collaboration Diagram

– State chart Diagram

– Activity Diagram

• Implementation Diagram– Component Diagram

– Deployment Diagram

Page 47: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 47

Structure Diagram

• Class Diagram– A set of components : Class and its relations

• Object Diagram– Snap shot of the system at one time

• Package Diagram– Model Configuration management– Variations of Classes

Page 48: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 48

Behavior Diagram• Use Case Diagram

– External functional capabilities of the system

• Sequence Diagram– time sequence of interactive objects

• Collaboration Diagram– Interaction of object groups

• State Chart Diagram– State transition, that’s Object life history

• Activity Diagram– Control flow of the process for one interaction

Page 49: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 49

Implementation Diagram

• Component Diagram– Dependency among Software Units

• Deployment Diagram– Distributed deployment and interactions of

components and objects on the computational nodes such as CPU, Process and Devices)

Page 50: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

Stepwise Understanding UML 50

Architecture and 4+1ViewsArchitecture and 4+1Views

Use Case/ScenarioUse Case/ScenarioViewView

LogicalLogicalViewView

ComponentComponentViewView

DeploymentDeploymentViewView

ParallelParallelViewView

○○End UsersEnd Users Vocabulary and ConceptVocabulary and Concept Requirements/FunctionalityRequirements/Functionality

○○ProgrammerProgrammer SW CFMSW CFM Dev. Artifacts MngmntDev. Artifacts Mngmnt

○○AnalystAnalyst○○TesterTester

○○System IntegratorSystem Integrator PerformancePerformance Scalability Scalability Through put Through put

BehaviorBehavior

○○System EngineerSystem Engineer Distributed Topology Distributed Topology Deliver Deliver 、、 InstallInstall Communication Network Communication Network

(Implement View)(Design View)

○○Project MgrProject Mgr○○ArchitectArchitect

Dev. UnitDev. Unit

Page 51: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Semantics 51

Introduction to UML Semantics

• UML Standard Extension Mechanism

• OCL Primer

• 4 Layers Meta Model Architecture

• UML Meta Model Structure

• UML Abstract Syntax and Examples

• UML Well Formedness Rules and Examples

• UML Semantics Descriptions

Page 52: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Semantics 52

UML Stereotype

Definition : To specialize the UML Core Base• 4 Specifications

– Base Class ( Meta-Class or Other Stereotype )• Specify the basic model to extend

– Constrains • What is special about this stereotype?

– Tag ( Property)• Specify tags as tagged values

– Icon • If Different Icons are needed 。。。

Page 53: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Semantics 53

Definition of Stereotype

• UML1.4 Notation《metaclass》

Class

《stereotype》TestStub

《stereotype》Stereotype Declaration

TagsLogFileName : String[0..1]LogID : String

Constraints{LogID less than 5 letters}

Tag ListProperty of Meta-class

Tag value and otherconstrains

Page 54: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Semantics 54

Stereotype for Constrains

• 3 Stereotypes of UML Constrains:– 《 invariant 》: for Class

• All instances of the class

– 《 pre-condition 》: for Operations• True before the operation execution

– 《 post-condition 》: for Operations• True after the operation execution

Page 55: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Semantics 55

What’s OCL ?• Object Constrain Language OCL

– Object Constraint Language

• Visual models like Class diagrams are insufficient to write precise rigorous spec

• Need to put constrain description to the object in the model

• OCL:formal language ease to read and write– more rigorous than NL and easier

understanding than the first order logic

Page 56: What is UML ? ISFST2002 Tutorial in X’ian October 21, 2002

UML Semantics 56

OCL Characteristics

• Pure Expression Language、 no side effect– Nothing of the Model to be changed

• OCL is not a Programming Language– Unable to write logic and control flows

• OCL expression has a Type

• OCL Type is a kind of Classifier in UML