v 1.0 -- 11/30/2015 12:30:32 pm© 2000 jean-paul rigaultuml: analysis & design -- 1 analysis and...

71
V 1.0 -- 03/16/22 01:18 AM © 2000 Jean-Paul Rigault UML: Analysis & Design -- 1 Analysis and Design with the UML Jean-Paul Rigault Professor at ESSI (École supérieure en sciences informatiques) University of Nice Sophia Antipolis, France Email: [email protected]

Upload: dinah-fisher

Post on 13-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

1

Analysis and Design with the UML

Jean-Paul RigaultProfessor at ESSI (École supérieure en sciences

informatiques)University of Nice Sophia Antipolis, FranceEmail: [email protected]

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

2

Objectives

Complement the UML notation specifically for design

Revisit class and interaction diagrams Introduce state-transition diagrams Introduce component diagrams

Using Rational Rose Code generation from UML models

Round trip engineering

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

3

Contents

The Rational Rose tool Notations for design

Class diagrams Interaction diagrams: sequence and collaboration

Design diagrams State-transition diagrams Component diagrams, deployment diagrams

Introduction to code generation and round-trip engineering with Rational Rose

References

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

4

The Rational Rose Tool

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

5

Rational Rose 2000eGeneral Characteristics

Market leader Not UML 1.3 compliant…

Not even 1.1 compliant! Implements (partially) all 9 UML diagrams Allows (textual) specifications and links with

external files or URL’s Methodology independent

But presents the 4+1 views (in fact (4-1)+1 views!)

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

6

Rational Rose 2000eCode Generation

Set the standard for code generation from UML diagrams

Only from class diagrams for the standard version Highly parametrized code generation Many languages: C, C++, Java, Corba IDL, SQL,

Ada, XML… Good connection with Microsoft development tools:

Source repository, Visual Basic, Visual C++, COM… Allows

Reverse engineering Round trip engineering

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

7

Rational Rose 2000eModel Exchange Formats

Model format is proprietary Defined API (Visual Basic) to access model

representations Possible to export models in XMI (XML for UML)

Many other vendors tools can read Rose format

However the tools are very different w.r.t. the UML standard compliance

Exchanging models is not simple…

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

8

Rational Rose 2000eRose Views

The 4+1 views of architecture modeling

Threads and processesConcurrency andSynchonizationProcess View

Threads and processesConcurrency andSynchonizationProcess View

Implementation ViewComponents and files

ReleasesConfigurationmanagement

Implementation ViewComponents and files

ReleasesConfigurationmanagement

Design ViewVocabulary of the systemand its solutionFunctionalRequirements

Design ViewVocabulary of the systemand its solutionFunctionalRequirements

Support hardwareDistribution, installation

Deployment View

Support hardwareDistribution, installation

Deployment View

Use Case ViewBehavior of the systemServices for end users

Use Case ViewBehavior of the systemServices for end users

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

9

Rational Rose (version 2000e)

Browser(3+1 views)

Diagrameditors

Documentation

Editor palette

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

10

Rational Rose 2000eRose Views and Diagrams

Mapping the UML building blocks on the 4+1 views

Same diagrams as for the Design ViewFocus on active classes

Process View

Same diagrams as for the Design ViewFocus on active classes

Process View

Implementation ViewComponent diagrams

Interaction, statecharts,and activity

diagrams

Implementation ViewComponent diagrams

Interaction, statecharts,and activity

diagrams

Design ViewClass & object diagramsInteraction, statecharts,and activitydiagrams

Design ViewClass & object diagramsInteraction, statecharts,and activitydiagrams

DeploymentDiagrams

Interaction, statecharts,and activity diagrams

Deployment View

DeploymentDiagrams

Interaction, statecharts,and activity diagrams

Deployment View

Use Case ViewUse case diagrams

Interaction, statecharts, and activitydiagrams

Use Case ViewUse case diagrams

Interaction, statecharts, and activitydiagrams

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

11

Notations for Design

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

12

Contents

Revisiting class diagrams Visibility and scope Template classes Qualified associations Derived entities Metaclasses

Revisiting interaction diagrams: Message types Conditions (guards) Concurrency (multithreading)

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

13

Revisiting Class Diagrams:Visibility and Scope

Person+ last_name : String+ first_name : String+ address : Address- friends : Set<Personne># all : Set<Personne>

+ create() : Personne- register(Service) : Integer+ marry(partner : Personne)+ move(Address) : Boolean

Access control+ public# protected- private

Static members

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

14

Revisiting Class Diagrams:Template Classes

ListT

List<Integer>

Generic classT is a type

Generic instance

« bind » (Integer)

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

15

Revisiting Class Diagrams:Qualified Associations

Directory Filecontains 0..*1

0..1Directory File1name

navigation

Cardinality decreases since target gets partitioned

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

16

Revisiting Class Diagrams:Qualified Associations (cont.)

Entreprise Personemploys

**function

There is still target partioning, althoughcardinality does not seem to decrease…

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

17

Revisiting Class Diagrams:Derived Entities: Derived Attributes

Person

birthday/age

Redundant attributes

{age = today - birthday}

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

18

Revisiting Class Diagrams:Derived Entities: Derived Associations

Entreprise Department*

Person*

1

/ works for

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

19

Revisiting Class Diagrams:Metaclasses

« metaclass »

CarModel

Peugeot 306

Peugeot 306Sedan

Peugeot 306Convertible

A metaclass is a class, the instances of which are classes

Do not confusewith inheritance!

« instanceOf »

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

20

Revisiting Interaction DiagramsMessage Types

Synchronous Function/procedure call, wait for return

Asynchronous Send an event, no return expected

Balking Do not delivered if the receiver is not waiting

for it and notify sender Timed Out Periodic Etc.

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

21

Revisiting Interaction DiagramsMessage Types (cont.)

: anObject : anOtherObject

Synchronous:function call, implicit return

f(x)

f(x) Synchronous:function call, explicit returnresult

Simple

Asynchronous

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

22

Revisiting Interaction DiagramsConditions (Guards)

: Object1 : Object2 : Object3

[x > 0] foo()

[x <= 0] bar()

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

23

Revisiting Interaction DiagramsFocus of Control

: Object1 : Object2 : Object3

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

24

Revisiting Interaction DiagramsConcurrency (Multithreading)

: Object1 : Object2 : Object3

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

25

Design Diagrams

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

26

Contents

State-transition diagrams Events and states, StateCharts Simple state-transition diagrams Hierarchical state-transition diagrams Concurrent state-transition diagrams State-transition and activity diagrams

Component diagrams Definition and types of components Component dependencies Component and code generation

Deployment diagrams

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

27

State-Transition DiagramsEvents

Null duration Require an operation of the target

object Attributes

Events may carry value Occurrence time: implicit attribute

Events and event classes Event: unique occurrence Event classes: multiple occurrences

Common structure Organization in classes (composition,

inheritance…)

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

28

State-Transition DiagramsStates

Abstraction of values of attributes and the status of links

Change as a response to receiving an event

In general, duration is not null

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

29

State-Transition DiagramsStates and Events Separation

Events separate states States separate events

state 2 state 4state 1 state 3 state 5

events

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

30

State-Transition Diagrams

Relationship between events and states

Associated with objects (classes) with a reactive behaviour

Finite state machines Model borrowed from Harel’s StateCharts Rather precise semantics

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

31

State-Transition DiagramsStates and Transitions

event(attributes)[condition]/action^send’s

initial state

final state do: actionentry/actionexit/actionévénement/

action

variables

State name

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

32

State-Transition DiagramsSimple State-Transition Diagrams

At terminal

Roulage

Taking off

Landing

Flying

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

33

State-Transition DiagramsSimple State-Transition Diagrams (cont. 1)

White play Black play

Start

No Time No Time

Black win

mat pat

Nul

matpat

White win

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

34

State-Transition DiagramsSimple State-Transition Diagrams (cont. 2)

Idle Visible

do: execute()cursor_move

/mark_selection

Spontaneous transition(termination of do:)

bouton_down/display_menu

bouton_up/erase_menu

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

35

State-Transition DiagramsSimple State-Transition Diagrams (cont. 3)

Ask passwd Cont...passwd entered(mp)[correct(mp)]

passwd entered(mp)[not correct(mp)]/display_errorr()^error_log.incr()

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

36

State-Transition DiagramsHierarchical ST Diagrams

No Time

mat pat

Black win Nul

Assess Search

Evaluate

White play

/play

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

37

State-Transition DiagramsHierarchical ST Diagrams (cont. 1)

Neutral BackwardR

NF N

Forward

1st 2nd 3rdup up

downdownstop

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

38

State-Transition DiagramsHierarchical ST Diagrams (cont. 2)

The history pseudo-state memorizes the current substate and forcesits re-entry when re-entering the macro-state

Neutral BackwardN

F N

Forward

1st 2nd 3rdup up

downdownstop

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

39

State-Transition DiagramsConcurrent ST Diagrams

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

40

State-Transition DiagramsConcurrent ST Diagrams (cont.)

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

41

Component DiagramsDefinition and Types of Components

Component = Physical element A part of the system implementation Script, library, source, binary, data file, data

table… Stereotypes for components

Document Executable File Library Table Threads Processus…

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

42

Component DiagramsDefinition and Types of Components(cont.)

person.cpp<< file >>

graphic_lib.so<< library >>

+ Window + Button

+ ScrollBar

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

43

Component DiagramsComponents Dependencies (1)

Userinterface

SimulationEngine

AircraftModel

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

44

Component DiagramsComponents Dependencies (2)

Component interface

Component dependencies

Person

Organizer

Calendar

Datation

Rendez-vous

Interface

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

45

Component DiagramsComponents and Code Generation

(Source) Components are the focus of code generation

Each (source) component has an associated programming language code generation properties (property set) a set of classes that are implemented by the

component(there is often one unique class per basic component)

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

46

Deployment Diagrams

Describe the physical layout of the (hardware) devices

constituting the system at run-time (the nodes) their interconnection and its topology the mapping of components, processes, tasks,

and objects that are supported at run-time by theses nodes

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

47

Deployment DiagramsNodes and Links

OperatorWS : PCHost

S1 : ServerHost

<< TCP/IP >>

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

48

OperatorWS : PCHost

S1 : ServerHost

<< TCP/IP >>

Deployment DiagramsNodes and Links, Components

Userinterface

SimulationEngine Aircraft

Model

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

49

Introduction to Code Generation and Round-Trip Engineering with Rational Rose

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

50

Contents

Code generation Principle of code generation in Rose Generating classes and associations Parameters for code generation (CG properties)

Reverse engineering and Round-trip engineering

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

51

Code GenerationPrinciple of Code Generation in Rose

Rose 2000e generates code only for classes The class descriptions must be reasonably complete:

operation signatures, types of attributes, access control…

Some tools exist to generate code from behavioral descriptions (state diagrams) : Rose RT, StateMate…

Classes are usually gathered into components

Identical generation language Identical set of code generation properties

The code generator usually generates a skeleton that the programmer has to stuff with its own (application) code

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

52

Code GenerationGenerating Classes and Associations

Attributes No generation problem if type is given Setters and getters are optionally generated

Operations No generation problem if signature is given Generate only a skeleton

Special purpose operations E.g., in C++, default constructor, copy constructor,

destructor (virtual or not), assignment operator… Generated according to code generation properties

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

53

Code GenerationGenerating Associations

Generating associations relies on the use of collections

Ordered or not (sequences, sets) With repetition or not (bags, sets) With sharing or not With indexing operation or not…

Many libraries are available which implement such collections

MFC, C++ STL, C++ Booch’s Components, Java Swing…

For C++, by default Rose uses the MFC

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

54

Code GenerationGenerating Associations (cont. 1)

Simple associations

PersonEntreprise0..1 *

Class Personne{ …private: Entreprise *the_Entreprise; …};

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

55

Code GenerationGenerating Associations (cont. 2)

Multiple associations

class Entreprise{ …private: UnboundedSetByReference<Person> employees; …};

PersonEntreprise0..1 *

- employees

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

56

Code GenerationGenerating Associations (cont. 3)

Strong aggregation (Composition)

class Entreprise{ …private: UnboundedSetByValue<Department> the_Department; …};Department

Entreprise

*

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

57

Code GenerationGenerating Associations (cont. 4)

Weak aggregation (Aggregation)

class Entreprise{ …private: UnboundedSetByReference<Person> employees; …};

PersonEntreprise0..1

*- employees

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

58

Code GenerationGenerating Associations (cont. 5)

Multiple associations: association tables

PersonEntreprise *- employees

*- employers

E1

E2

P1

P2

P3

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

59

Code GenerationGenerating Associations (cont. 6)

Multiple associations: association tables

class Entreprise{ …private: AssocTable<Entreprise, Person> *employs;};

PersonneEntreprise ** employs

class Personne{ …private: AssocTable<Entreprise, Person> *employs;};

template <typename U, typename V> class AssocTable;

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

60

Reverse Engineering

The opposite of code generation From source code to models and

diagrams Works only for classes and class

diagrams Sometimes, dubious results!

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

61

Round Trip Engineering

Elaborate model

Generate code

Modify code

Modify model

What about the applicationcode ? How to preserve it ?How to deal with programmer’smodifications to the code?

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

62

Round Trip Engineering (cont.)

Elaborate model

Generate code

Modify code

ReverseEnginering

Modify model

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

63

References

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

64

The Object-Oriented ApproachGenerality

Object-Oriented Software EngineeringIvar JacobsonAddison Wesley, 1993

Object Oriented Analysis and DesignGrady BoochSecond Edition, The Benjamin/Cummings Publ. Co., 1994

Object-Oriented Software ConstructionBertrand MeyerPrentice Hall, 1988

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

65

The Object-Oriented ApproachMethodology

The Unified Software Development Process

Ivar Jacobson, Grady Booch, James RumbaughAddison Wesley, 1999

Object Solutions: Managing the Object-oriented Project

Grady BoochAddison Wesley, 1996

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

66

The Unified Modeling LanguageOfficial References

OMG Unified Modeling Language Specification

Object Management Group, Inc.Version 1.3, June 1999

URL's: http://www.omg.com http://www.rational.com/uml

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

67

The Unified Modeling LanguageTutorial Books

The Unified Modeling Language User Guide

Grady Booch, James Rumbaugh, Ivar JacobsonAddison Wesley, 1999

The Unified Modeling Language Reference Guide

Grady Booch, James Rumbaugh, Ivar Jacobson Addison Wesley, 1999

UML in a NutshellSinan Si AlhirO ’Reilly, 1998

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

68

The Unified Modeling LanguageUsing the UML

Applying Use Cases: A Practical GuideGeri Schneider, Jason P. Winters Addison Wesley, 1998

UML DistilledMartin Fowler (with Kendall Scott)Addison Wesley, 1997

Visual Modeling with Rational Rose and UML

Terry QuatraniAddison Wesley, 1998

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

69

The Unified Modeling LanguageThe Object Constraint Language (OCL)

The Object Constraint Language: Precise Modeling with UML

Jos Warmer, Anneke Kleppe Addison Wesley, 1999

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

70

The Unified Modeling LanguageThe UML for French Readers

Modélisation objets avec UMLPierre-Alain Muller, Nathalie Gaertner 2e édition, Eyrolles, 2000

UML en actionPascal Roques, Franck ValléeEyrolles, 2000

De Merise à UMLNasser Kettani, Dominique Mignet, Pascal Paré, Camille Rosenthal-SabrouxEyrolles, 1998

V 1.0 -- 04/18/23 05:46 PM © 2000 Jean-Paul RigaultUML: Analysis & Design --

71

The End…