25
UML / UML 2.0 Diagrams (Part I) 1

UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Embed Size (px)

Citation preview

Page 1: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

UML / UML 2.0 Diagrams

(Part I)

1

Page 2: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Overview of the 13 diagrams of UML

Structure diagrams1. Class diagram2. Composite structure diagram (*)3. Component diagram4. Deployment diagram5. Object diagram6. Package diagram

Behavior diagrams1. Use-case diagram2. State machine diagram3. Activity diagram

Interaction diagrams1. Sequence diagram2. Communication diagram 3. Interaction overview diagram (*)4. Timing diagram (*)

(*) not existing in UML 1.x, added in UML 2.0

2

Page 3: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

UML principle: diagram vs. model

• Different diagrams describe various facets of the model

• Several diagrams of the same kind may coexist

• Each diagram shows a projection of the model

• Incoherence between diagrams (of the same or of different kind(s)) correspond to an ill-formed model

• The coherence rules between different kinds of diagrams is not fully stated

3

Page 4: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Use case diagram

• Displays the relationship among actors and use cases, in a given system

• Main concepts:o System – the system under modelingo Actor – external “user” of the systemo Use case – execution scenario, observable by

an actor

4

Page 5: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

5

Page 6: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

6

Page 7: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Class diagram

• The most known and the most used UML diagram

• Gives information on model structural elements

• Main concepts involvedo Class - Objecto Inheritanceo Association (various kinds of)

7

Page 8: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

UML Class

• Gives the type of a set of objects existing at run-time• Declares a collection of methods and attributes that

describe the structure and behavior of its objects

8

Page 9: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Properties of UML classes

• May own featureso Structural (data related) : attributeso Behavioral : methods/operations

• May own behavior (state machines, interactions, …)

• May be instantiated o except for abstract classes that can NOT be directly

instantiated and exist only for the inheritance hierarchy

9

Page 10: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Decode class symbol adornments

Class name in italics: abstract

class

Underlined attribute = class

attribute

Simple class box: passive class

Vehicle

Automobile

+wheelsNO : integer

-serialNo : integer

+fillTank(In volume:real):real

Door

+wheelsNO : integer

-serialNo : integer

door 1 *

+fillTank(In volume:real):realFeature visibility +,

-, #,~

Attributes area

Method(operation)

area

10

Page 11: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

11

Page 12: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Object

• Instance of a class• Can be shown in a class diagram• Notation

ford : Automobile

wheelsNO=4

serialNo=123ABC567

wheelsNO=4

serialNo=123ABC567D

12

Page 13: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Relations

• Inheritance• Association (Aggregation, Composition)• Refer to UML_Class_Relation.ppt

13

Page 14: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Interface

• Declares set of public features and obligations• Specifies a contract, to be fulfilled by classes implementing the

interface

• Not instantiable (abstract class)

• Its specification can be realized by 0, 1 or several classes

• Interfaces hierarchies can be defined through inheritance relationships

• In UML 2.0, interface may also include attributes and a special form of a state machine called a protocol state machine.

14

Page 15: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Interface definition and use examples

<<interface>>InteractionPrimitives

tokenExchange(

<<interface>>SecureInteraction

checkConsistency

retrieveLast()

checkConsistency()

tokenExchange()

SatelliteSecureInteraction

The class Satellite provides implementation for the 3

operations

15

Page 16: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Service Requester vs. Provider

Interface SiteSearch is realized (implemented) by SearchService.

Interface SiteSearch is used (required) by SearchController

16

Page 17: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

17

Page 18: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Package

18

• Used to reflect the organization of packages and their elements.

• When used to represent class elements, package diagrams provide a visualization of the namespaces (domains).

• Subdivide models to permit teams of developers to manipulate and work effectively together

• Typically a logical view (compared against the component/subsystem/deployment diagrams)

Page 19: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

19

Page 20: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Component

• Its definition evolves from UML 1.x to UML 2.0• In UML 1.x - deployment artifacts• In UML 2.0 – structured classes Modular unit with well-defined interfaces that is

replaceable within its environment Autonomous unit within a system

•Has one or more provided and required interfaces•Its internals are hidden and inaccessible•A component is encapsulated•Its dependencies are designed such that it can be treated as independently as possible

20

Page 21: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

A component can have…• Interfaces

– An interface represents a declaration of a set of operations and obligations

• Usage dependencies– A usage dependency is relationship which one element requires

another element for its full implementation• Ports

– Port represents an interaction point between a component and its environment

• Connectors – Connect two components (links are used to connect objects)– Connect the external contract of a component to the internal

structure

21

Page 22: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

22

Page 23: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Subsystem

• Used to decompose the physical organization of large-scale system at the highest level of abstraction

23

Page 24: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

Nodes and Deployment

Nodes: Devices and Execution environment

Focused on the artifacts that deploy executables (i.e., .exe, .dll, .lib files)

24

Page 25: UML / UML 2.0 Diagrams (Part I) 1. Overview of the 13 diagrams of UML Structure diagrams 1.Class diagram 2.Composite structure diagram (*) 3.Component

25