uml

73
UML Unified Modeling Language Presented By- Shah Imran Alam CDAC- Mumbai

Upload: api-3704955

Post on 13-Dec-2014

21 views

Category:

Documents


5 download

DESCRIPTION

Ultimate PPT for UML...

TRANSCRIPT

Page 1: Uml

UML Unified Modeling Language

Presented By-

Shah Imran Alam

CDAC- Mumbai

Page 2: Uml

Why We Model ?

What is UML ?

The UML language is for

Visualizing

Specifying

Constructing

Documenting

Page 3: Uml

Three major elements of UML

Building Blocks Rules Common Mechanism

Page 4: Uml

Building Blocks Of UML

Things

Relationship

Diagrams

Page 5: Uml

Four Kinds Of Things In UML

Structural Things Behavioral Things Grouping Things Annotational Things

Page 6: Uml

Structural Things (Nouns of UML)

Class Interface Collaboration Use Cases Active Classes Components Nodes

Page 7: Uml

Structural Things (Cont…)

The nouns of UML models are usually the static

parts of the system in question.

Class - an abstraction of a set of things in the problem-domain that have similar properties and/or functionality.

Notation:

Windoworiginsize

open()close()move()display()

Page 8: Uml

Structural Things (Cont…)

Notation:

Interface - A collection of operations that specify the services rendered by a class or component.

CheckSpelling

Page 9: Uml

Structural Things (Cont…)

Notation:

Collaboration - a collection of UML building blocks (classes, interfaces, relationships) that work together to provide some functionality within the system.

Chain Of Responsibility

Page 10: Uml

Structural Things (Cont…)

Notation:

Use Case - an abstraction of a set of functions that the system performs; a use case is “realized” by a collaboration.

Process

Order

Page 11: Uml

Structural Things (Cont…)

Notation:

Active Class - a class whose instance is an active object; an active object is an object that owns a process or thread (units of execution)

eventManager

Page 12: Uml

Structural Things (Cont…)

Notation:

Component - a physical part (typically manifests itself as a piece of software) of the system.

DML_Parser.C

Page 13: Uml

Structural Things (Cont…)

Notation:

Node - a physical element that exists at run-time and represents a computational resource (typically, hardware resources).

PrintServer

Page 14: Uml

Behavioral Things (Verbs of UML)

Interaction Static machine

Page 15: Uml

Behavioral Things (contd)

Interaction

The verbs of UML models; usually the dynamicparts of the system in question.

some behaviour constituted by messages exchanged among objects; the exchange of messages is with a view to achieving some purpose.

ParseNotation:

Page 16: Uml

Behavioral Things (contd)

State machine

A behavior that specifies the sequence of “states” an object goes through, during its lifetime. A “state” is a condition or situation during the lifetime of an object during which it exhibits certain characteristics and/or performs some function.

Notation:EngineIdling

Page 17: Uml

Grouping Things (Packages)

The organizational part of the UML model, provides a higher level of abstraction (granularity).

A general-purpose element that comprises UML elements - structural, behavioral or even grouping things. Packages are conceptual groupings of the system and need not necessarily be implemented as cohesive software modules.

.

AccountsDepartment

Notation:

Page 18: Uml

Annotational Things (Note)

The explanatory part of the UML model; addsinformation/meaning to the model elements. A graphical notation for attaching constraints and/or

comments to elements of the model.

Notation:Parses user-query and builds expression stack ( invokes ErrorHandler)

Page 19: Uml

A Few Other Example

Page 20: Uml

Relationships In UML

Dependency Association Generalization Realization

Page 21: Uml

Relationships (contd)

Dependency

Articulates the meaning of the links between things.

A semantic relationship where a change in one thing (the independent thing) causes a change in the semantics of the other thing (the dependent thing).

(arrow-head points to the independent thing)Notation:

Page 22: Uml

Relationships (contd)

Association

A structural relationship that describes the connection between two things.

Notation:

Page 23: Uml

Associational (usage) relationships1. multiplicity (how many are used)

* 0, 1, or more

1 1 exactly

2..4 between 2 and 4, inclusive

5..* 5 or more

2. name (what relationship the objects have)

3. navigability (direction)

Page 24: Uml

An Example

Student Courseenroll

advisee

advisorFaculty

6..* 0..*

1

0..*Course

0..*

1

teach

1..*

1

Page 25: Uml

Association Class

Adds attributes and operations to an association– Allows exactly one instance of the association class

between any two objects– Can use an actual class instead, if you need more

PersonCompany0..* 1..*

Job

descriptiondateHiredsalary

employeeemployer

Page 26: Uml

Special cases of Association

Aggregation : "is part of" symbolized by a clear white diamond.

Composition : "is entirely made of“ symbolized by a black diamond.

Page 27: Uml

Aggregation

Special form of association representing has-a or part-whole relationship.

Distinguishes the whole (aggregate class) from its parts (component class).

No relationship in the lifetime of the aggregate and the components (can exist separately).

Aggregate Component

Page 28: Uml

Aggregation Example

room

wall

Page 29: Uml

Composition

Stronger form of aggregation

Implies exclusive ownership of the component class by the aggregate class

The lifetime of the components is entirely included in the lifetime of the aggregate (a component can not exist without its aggregate).

Composition Component

Page 30: Uml

A Composition Example

Document

Paragraph

Sentence

Word

0..*

1..*

1..*

Page 31: Uml

An Example

Department

member-of

Faculty

College

chair-of

Student

1

1 1

1

1 1

1..*

0..*1..*

1..*

University

Page 32: Uml

Relationships (contd)

Generalisation

A relationship between a general thing (called “parent” or “superclass”) and a more specific kind of that thing (called the “child” or “subclass”), such that the latter can substitute the former.

Notation:(arrow-head points to the superclass)

Page 33: Uml

Generalization (inheritance) relationshipshierarchies drawn top-down with arrows pointing upward to parent

line/arrow styles differ, based on whether parent is a(n):

class:solid line, black arrow

abstract class:solid line, white arrow

Page 34: Uml

An Example

Page 35: Uml

Relationships (contd)

Realization

A semantic relationship between two things wherein one specifies the behavior to be carried out, and the other carries out the behavior.

Notation:

(arrow-head points to the thing being realized)

Page 36: Uml

Realization (representations)

Page 37: Uml

Another example

Page 38: Uml

Diagrams with UML

UML includes nine diagrams - each capturing a different dimension of a software-system architecture.

Class DiagramObject DiagramUse Case DiagramSequence Diagram Collaboration Diagram

Statechart DiagramActivity DiagramComponent DiagramDeployment Diagram

Page 39: Uml

Common Mechanism

Mechanisms/elements that apply consistently throughout the language:

Specifications

Adornments

Common Divisions

Extensibility Mechanisms

Page 40: Uml

Adornments

visibility: + public

# protected- private/ derived

underline static methods/attributes

parameter types listed as (name: type)

Italics Abstract Class

Page 41: Uml

Common Division

There is a division of class and objects

Customer Joe : Customer

: Customernameaddressphone

Joe

Page 42: Uml

Common Division

There is a separation of Interface and Implementation

Spellingwizard.dll

IUnknown

ISpelling

Page 43: Uml

Extensibility Mechanism

Stereotype : Extends the vocabulary of the UML

Tagged value : Extends the properties of the UML

Constraints : Extends the semantics of the UML

EventQueue {version=3.4 author =sia}

add()removeflush()

<<exception>>Overflow {ordered}

Page 44: Uml

Another Example (Stereotype)

Page 45: Uml

Another Example (Tagged value)

Page 46: Uml

Another Example (Constraints)

Page 47: Uml

Revisiting Classes (Modeling advanced features)

Abstract, root and leaf elements

Page 48: Uml

Multiplicity

Page 49: Uml

Attributes

The Syntax of an attribute in the UML is

[visibility] name [multiplicity] [:type] [=initial-value] [{property-string}]

Example-

+ name [0..1] :String

origin : Point = (0,0)

id : integer {frozen}

Can be one ofchangeable, addOnly, frozen

Page 50: Uml

Operations

visibility name ( parameter-list ) : return-type { property-string }

can be: isQuery (does not change state of the object) sequential (should not be called concurrently) guarded (like synchronized)concurrent (canbe executed concurrently)

Parameters can be marked as in, out, inout

Page 51: Uml

Modeling static types (role-change)

Page 52: Uml

Revisiting Association (Modeling advanced features)

Navigation

Unless otherwise specified, navigation across an association is bidirectional.

Navigation could be limited to one direction. By specifying the direction of traversal.

Page 53: Uml

Visibility

Page 54: Uml

Qualification

Page 55: Uml

Interface Specifier

Page 56: Uml

Class Diagrams

DVD Movie VHS Movie Video Game

Rental Item

Rental Invoice

1..*1

Customer

Checkout Screen

0..1

1

Simple

Association

Class

Abstract

Class

Simple

Aggregation

GeneralizationComposition

Multiplicity

Page 57: Uml

Modeling a schema

Page 58: Uml

Object Diagram

Page 59: Uml

Interaction Diagram

Model the dynamic behaviour of the system; the flow of control within an operation.

Describe the interaction between objects; objects interact through messages to fulfill tasks.

Interaction provides behaviour and typically implements a Use Case.

Two types of interaction diagrams in UML– Sequence Diagrams (temporal dimension)– Collaboration Diagrams (structural dimension)

Page 60: Uml

Sequence Diagram

Sequence diagram is an interaction diagram that emphasizes the time-ordering of messages in an interaction.

Models interaction as a two-dimensional chart.

Objects participating in the interaction are plotted along the X-axis, time on the Y-axis.

Y-axis models the objects lifeline.

Messages passed between objects manifest the interaction.

Page 61: Uml

An Example

Page 62: Uml

Collaboration diagram

Collaboration diagram is an interaction diagram that emphasizes the structural organization of objects participating in an interaction.

It showsobjects / classes

links between them

message flow along links

Messages are numbered to show sequence

Page 63: Uml

An Example

Page 64: Uml

Use Case Diagram

Use Case Diagrams is the UML mechanism for requirements capture.

Use Case Diagrams are a graphical presentation of the “actors” in the domain and the “use cases” initiated by them.

“Use cases” are abstractions of discrete behavior exhibited by the system; perform a specific goal for an “actor”.

An “actor” is an abstraction of a role played by anyone or anything interacting with the system.

Page 65: Uml

Common Uses

To Model the context of the system To Model the requirements of the system.

Page 66: Uml

Modeling the context of the system

Page 67: Uml

Modeling the requirements of the system

Page 68: Uml

Another Example (A complete picture)

Page 69: Uml

Use Cases and Scenarios

A Use Case actually describes a set of sequences [of actions].

Each sequence represents one possible flow of actions in using the system.

Each sequence is called a Scenario.

A Scenario is basically one instance of a use case.– a Scenario is to a Use Case, what an Object is to a Class.

Page 70: Uml

Use Case Realization

The use case diagram is an external view of the system

A use case is realized in a collaboration

A collaboration shows an internal implementation- dependent solution of a use case in terms of:

– classes/objects– their relationships– their interaction

Page 71: Uml

Realization (A Higher level of Abstraction)

Page 72: Uml

Realization

Use Case A:ClassA :ClassB

:ClassC :ClassD

1: msg1

2: msg2

3: msg3

A Collaboration

Class A

Oper1()...

Class B

Oper2()...

Class C

Oper3()...

<<implements>> <<implements>> <<implements>>Use Case A description1. Step 12. Step 23. ...

Page 73: Uml