Top Banner

of 135

IBM Introduction to UML 2

Apr 05, 2018

Download

Documents

stuartro
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/31/2019 IBM Introduction to UML 2

    1/135

    IBM Software Group

    2005 IBM Corporation

    Introduction to UML 2.0

    Terry QuatraniUML Evangelist

  • 7/31/2019 IBM Introduction to UML 2

    2/135

    IBM Software Group

    2

    Session Objectives

    ! After completing this session, you should be able to:

    !Identify the different UML diagrams!Describe the purpose of each diagram

    !State where diagrams can be used

  • 7/31/2019 IBM Introduction to UML 2

    3/135

    IBM Software Group

    3

    Agenda

    ! The Importance of Modeling

    ! The Unified Modeling Language

    ! Model-Driven Architecture

    ! UML Diagrams

    ! Extending the UML

  • 7/31/2019 IBM Introduction to UML 2

    4/135

    IBM Software Group

    4

    Agenda

    ! The Importance of Modeling

    ! The Unified Modeling Language

    ! Model-Driven Architecture

    ! UML Diagrams

    ! Extending the UML

  • 7/31/2019 IBM Introduction to UML 2

    5/135

    IBM Software Group

    5

    The Importance of Modeling

  • 7/31/2019 IBM Introduction to UML 2

    6/135

    IBM Software Group

    6

    Why do we model?

    ! To manage complexity

    ! To detect errors and omissions early in the lifecycle

    ! To communicate with stakeholders

    ! To understand requirements

    ! To drive implementation

    ! To understand the impact of change

    ! To ensure that resources are deployed

    efficiently

  • 7/31/2019 IBM Introduction to UML 2

    7/135

    IBM Software Group

    7

    Agenda

    ! The Importance of Modeling

    ! The Unified Modeling Language

    ! Model-Driven Architecture

    ! UML Diagrams

    ! Extending the UML

  • 7/31/2019 IBM Introduction to UML 2

    8/135

    IBM Software Group

    8

    The Unified Modeling Language! The UML is the standard

    language for visualizing,

    specifying, constructing,and documenting theartifacts of a software-intensive system

  • 7/31/2019 IBM Introduction to UML 2

    9/135

    IBM Software Group

    9

    UML: The Language of Software Development

    UML 1.0UML partners

    UML 2.0Adopted major revision (2004)

    PublicFeedback

    Unified Method 0.8OOPSLA 95

    OMTBooch methodOOSEOther methods

    Web - June 1996 UML 0.9

    OMG Acceptance, Nov 1997

    Final submission to OMG, Sept 1997 UML 1.1

    Minor revision 1999UML 1.3

    Current minor revision 2001UML 1.5

    Grady

    Jim

    Ivar

    Blobs with writing in their hair

    And small adornments in the airAnd has-relations everywhere

    I've looked at clouds that way.But now I've purged them from my Sun

    Eliminated every oneSo many things I would have done

    To drive the clouds away.I've looked at clouds from both sides now

    Both in and out, and still somehowIt's clouds' delusions I appall

    I really can't stand clouds at allBalls for multiplicity

    Black and white for clarityAnd data flows arranged in trees

    Were part of OMT.But now I've had to let them goWe'll do it differently, you know

    'Cause Grady said, they've got to goWe can't use OMT.

  • 7/31/2019 IBM Introduction to UML 2

    10/135

    IBM Software Group

    10

    Approach to Evolving UML 2.0

    ! Evolutionary rather than revolutionary

    ! Improved precision of the infrastructure! Small number of new features

    ! New feature selection criteria

    !Required for supporting large industrial-scale applications!Non-intrusive on UML 1.x users (and tool builders)

    ! Backward compatibility with 1.x

  • 7/31/2019 IBM Introduction to UML 2

    11/135

    IBM Software Group

    11

    Formal RFP Requirements

    ! Infrastructure UML internals

    !More precise conceptual base for better MDA support!MOF-UML alignment

    ! Superstructure User-level features

    !New capabilities for large-scale software systems

    !Consolidation of existing features

    ! OCL Constraint language

    !Full conceptual alignment with UML

    ! Diagram interchange standard

    !For exchanging graphic information (model diagrams)

  • 7/31/2019 IBM Introduction to UML 2

    12/135

    IBM Software Group

    12

    Infrastructure Requirements

    ! Precise MOF alignment

    !Fully shared common core metamodel

    ! Refine the semantic foundations of UML (the UML metamodel)

    !Improve precision

    !Harmonize conceptual foundations and eliminate semantic overlaps

    !Provide clearer and more complete definition of instance semantics(static and dynamic)

  • 7/31/2019 IBM Introduction to UML 2

    13/135

    IBM Software Group

    13

    OCL Requirements

    ! Define an OCL metamodel and align it with the UMLmetamodel

    !OCL navigates through class and object diagrams must share acommon definition of Class, Association, Multiplicity, etc.

    ! New modeling features available to general UML users

    !Beyond constraints

    !General-purpose query language

    IBM S f G

  • 7/31/2019 IBM Introduction to UML 2

    14/135

    IBM Software Group

    14

    Diagram Interchange Requirements

    ! Ability to exchange graphical information between tools

    !Currently only non-graphical information is preserved during modelinterchange

    !Diagrams and contents (size and relative position of diagramelements, etc.)

    IBM S ft G

  • 7/31/2019 IBM Introduction to UML 2

    15/135

    IBM Software Group

    15

    Superstructure Requirements (1 of 2)

    ! More direct support for architectural modeling

    !

    Based on existing architectural description languages(UML-RT, ACME, SDL, etc.)

    !Reusable interaction specifications (UML-RT protocols)

    ! Behavior harmonization

    !Generalized notion of behavior and causality

    !Support choice of formalisms for specifying behavior

    ! Hierarchical interactions modeling

    ! Better support for component-based development

    ! More sophisticated activity graph modeling

    !To better support business process modeling

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    16/135

    IBM Software Group

    16

    Superstructure Requirements (2 of 2)

    ! New statechart capabilities

    !

    Better modularity! Clarification of semantics for key relationship types

    !Association, generalization, realization, etc.

    !

    Remove unused and ill-defined modeling concepts! Clearer mapping of notation to metamodel

    ! Backward compatibility

    !Support 1.x style of usage!New features only if required

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    17/135

    IBM Software Group

    17

    Language Architecture

    ! A core language + a set of optional language units

    ! Some language units have multiple levels

    OCLOCL

    Basic UMLBasic UML(Classes, Basic behavior, Internal structure, Use cases)(Classes, Basic behavior, Internal structure, Use cases)

    MOFMOF ProfilesProfiles

    StateStateMachinesMachines

    StructuredStructuredClasses andClasses andComponentsComponents

    ActivitiesActivities InteractionsInteractions DetailedDetailedActionsActions

    FlowsFlows

    Level 1Level 1

    Level 2Level 2

    Level 3Level 3

    UML InfrastructureUML Infrastructure

    Multiple levels ofcompliance

    Multiple levels ofMultiple levels ofcompliancecompliance

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    18/135

    IBM Software Group

    18

    The UML 2.0 Specification

    ! Can be downloaded fromhttp://www.omg.org/cgi-bin/doc?ptc/2004-10-02

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    19/135

    IBM Software Group

    19

    Agenda

    ! The Importance of Modeling

    !The Unified Modeling Language

    ! Model-Driven Architecture

    ! UML Diagrams

    ! Extending the UML

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    20/135

    IBM Software Group

    20

    Model-Driven Architecture (MDA)

    ! An OMG initiative to support model-driven developmentthrough a series of open standards

    (1) ABSTRACTION (2) AUTOMATION

    (3) OPEN STANDARDS

    Modeling languages Interchange facilities

    Model transformations

    Software processes

    etc.

    (3) OPEN STANDARDS

    Modeling languages Interchange facilities

    Model transformations

    Software processes

    etc.

    (3) OPEN STANDARDS

    Modeling languages Interchange facilities

    Model transformations

    Software processes

    etc.

    (3) OPEN STANDARDS

    Modeling languages Interchange facilities

    Model transformations

    Software processes

    etc.

    MDA

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    21/135

    IBM Software Group

    21

    The Languages of MDA! Set of modeling languages for specific purposes

    MetaObjectFacility (MOF)MetaObjectMetaObject

    Facility (MOF)Facility (MOF)

    A modeling languagefor defining modelinglanguages

    MOFcoreMOFMOFcorecore

    GeneralStandard UML

    GeneralGeneralStandard UMLStandard UML

    CommonWarehouse

    Metamodel (CWM)

    CommonCommonWarehouseWarehouseMetamodel (CWM)Metamodel (CWM)

    etc.etc.etc.

    General-purposemodeling language

    For exchanginginformation aboutbusiness and data

    Real-Timeprofile

    RealReal--TimeTimeprofileprofile

    EAI profileEAI profileEAI profile

    Softwareprocess profile

    SoftwareSoftwareprocess profileprocess profile

    etc.etc.etc.

    UMLbootstrap

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    22/135

    p

    22

    MOF (Metamodel) Example

    ! Uses (mostly) class diagram concepts to define! Language concepts

    ! Relationships between concepts

    *

    Relationship

    Element

    *

    0..1

    /ownedE lement*

    /owner0..1

    DirectedRelationship

    CommentElement

    1..*

    /source

    1..*

    1..*

    /target

    1..*

    *1..*1..*

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    23/135

    p

    23

    Agenda

    ! The Importance of Modeling

    !The Unified Modeling Language

    ! Model-Driven Architecture

    ! UML Diagrams

    ! Extending the UML

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    24/135

    24

    Meta-models and Notations

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    25/135

    25

    StructuralFeature

    (fromStructuralFeatures)

    Element(fromOwnerships)

    NamedElement(fromNamespaces)

    ValueSpecification

    (fromExpressions)

    InstanceValue

    InstanceSpecification

    1instance

    1

    Va lueSpeci ficat ion

    (fromExpressions)Slot*

    1

    slot *

    {subsets

    ownedElement}

    owningInstance

    1

    {subsets owner}

    1

    definingFeature

    1

    *0..1

    value

    *{ordered,subsets

    ownedElement}

    owningSlot

    0..1

    {subsets owner}

    1..*

    classifier

    1..*Classifier

    (fromClassifiers)

    Metamodel Description of Objects

    Object IdentifierObject IdentifierObject Identifier

    ObjectObjectObject

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    26/135

    26

    Metamodel Structure

    Different BehaviorFormalisms

    Different BehaviorDifferent BehaviorFormalismsFormalisms

    Structure-BehaviorDependency

    StructureStructure--BehaviorBehaviorDependencyDependency

    Shared Behavior

    Semantics

    Shared BehaviorShared Behavior

    SemanticsSemantics

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    27/135

    27

    Diagram Elements

    ! Each diagram has a frame, a content areaand a heading

    !

    The frame is a rectangle and is used todenote a border

    !Frame is optional

    ! The heading is a string contained in a

    name tag which is a rectangle with cut offcorners in the upper left hand corner of theframe

    !

    Format [] [] []! can be activity, class, component,

    interaction, package, state machine, usecase

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    28/135

    28

    Frame Example

    Package P

    Class 1 Class 2

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    29/135

    29

    UML 2.0 Diagrams

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachine

    Diagrams

    StateMachineDiagrams

    Composite

    StructureDiagrams

    CompositeStructureDiagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    Deployment

    Diagrams

    Deployment

    Diagrams

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    30/135

    30

    UML 2.0 Diagrams

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachine

    Diagrams

    StateMachineDiagrams

    Composite

    StructureDiagrams

    CompositeStructureDiagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    Deployment

    Diagrams

    Deployment

    Diagrams

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    31/135

    31

    Activities

    ! Significantly enriched in UML 2.0 (relative to UML 1.x activities)

    !More flexible semantics for greater modeling power (e.g., richconcurrency model based on Petri Nets)

    !Many new features

    ! Major influences for UML 2.0 activity semantics

    !Business Process Execution Language for Web Services(BPEL4WS) a de facto standard supported by key industryplayers (Microsoft, IBM, etc.)

    !Functional modeling from the systems engineering community

    (INCOSE)

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    32/135

    32

    Activity Diagram

    ! Activity diagrams show flow of control and data flow

    ! Typically used to model

    !Business process workflow

    !Flow within a use case

    !Business rules logic

    !Functional processes!UI screen flows

    [condition 1]

    [condition 3]

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    33/135

    33

    Activity Diagram

    Flight Selection post condition Flight selected

    Enter Departure

    Airport

    DepartureAirport

    Lookup City

    List ofAlternatives

    Select Flight

    [found > 1

    flight]

    [found 0 flights]

    [found 1 flight]

    CancelRequest Cancel

    Selection

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    34/135

    34

    Company

    Customer

    Accounting

    OrderDepartment

    Partitioning capabilities

    Receiveorder

    Fillorder

    Shiporder

    Sendinvoice

    Makepayment

    Invoice

    Acceptpayment

    Closeorder

    Seattle Reno

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    35/135

    35

    Company

    Accounting

    OrderDep

    artment

    Customer

    Partitioning capabilities

    Receiveorder

    Fillorder

    Shiporder

    Sendinvoice

    Makepayment

    Acceptpayment

    Closeorder

    Seattle Reno

    Invoice

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    36/135

    36

    Activities: Basic Notational Elements

    Control/Data FlowControl/Data Flow

    Activity or ActionActivity or Action

    Object NodeObject Node(may include state)(may include state)

    Pin (Object)Pin (Object)

    ChoiceChoice

    Control ForkControl Fork

    Control JoinControl Join

    Initial NodeInitial Node

    Activity FinalActivity Final

    Flow FinalFlow Final

    (Simple) Join(Simple) Join

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    37/135

    37

    A

    B

    X

    C

    Z

    Y

    Extended Concurrency Model

    ! Fully independent concurrent streams (tokens)

    Tokens representindividual executionthreads (executions ofactivities)

    NB: Not part of thenotation

    Tokens representindividual executionthreads (executions ofactivities)

    NB: Not part of thenotation

    Concurrency joinConcurrency join

    Concurrency forkConcurrency fork

    Valid output streams:ABCXYZ

    AXYBCZABXCYZAXBYCZABXYCZAXBCYZ

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    38/135

    38

    Activity 3Activity 2

    Activities: Token Queuing Capabilities! Tokens can

    !queue up in in/out pins

    !backup in network

    !

    prevent upstream behaviors from taking new inputs

    ! or, they can flow through continuously

    !taken as input while behavior is executing

    !given as output while behavior is executing!identified by a {stream} adornment on a pin or object node

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    39/135

    39

    Actions in UML

    ! Action = fundamental unit of behavior

    !for modeling fine-grained behavior

    !Level of traditional programming languages

    ! UML defines:

    !A set of action types

    !A semantics for those actions

    ! i.e. what happens when the actions are executed

    ! Pre- and post-condition specifications (using OCL)

    !No concrete syntax for individual kinds of actions (notation)

    ! Flexibility: can be realized using different concrete languages

    ! In UML 2, the metamodel of actions was consolidated

    !Shared semantics between actions and activities (Basic Actions)

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    40/135

    40

    ActivityNode(context)ActivityNode(context)

    VariableAVariableAVariableA

    .

    .

    .

    .

    .

    .

    Object Behavior Basics

    ! Support for multiple computationalparadigms

    .

    .

    .

    .

    .

    .Action1Action1

    .

    .

    .

    .

    .

    .Action3Action3

    .

    .

    .

    .

    .

    .Action2Action2

    Input PinInput Pin(typed)(typed)

    OutputPinOutputPin(typed)(typed) Control FlowControl FlowControl Flow

    Data FlowData Flow

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    41/135

    41

    Categories of Actions

    ! Communication actions (send, call, receive,)

    !

    Primitive function action! Object actions (create, destroy, reclassify,start,)

    ! Structural feature actions (read, write, clear,)

    !Link actions (create, destroy, read, write,)

    ! Variable actions (read, write, clear,)

    ! Exception action (raise)

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    42/135

    42

    UML 2.0 Diagrams

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachine

    Diagrams

    StateMachineDiagrams

    Composite

    StructureDiagrams

    Composite

    StructureDiagrams

    ClassDiagrams

    ClassDiagrams

    Use CaseDiagrams

    Use CaseDiagrams

    ActivityDiagrams

    ActivityDiagrams

    Deployment

    Diagrams

    Deployment

    Diagrams

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    43/135

    43

    Use Case Diagram

    ! Use case diagrams are created to visualize the relationshipsbetween actors and use cases

    ! Use cases are a visualization the functional requirements of asystem

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    44/135

    44

    Actors

    ! An actor is someone or some thing that must interact with thesystem under development

    Passenger Bank

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    45/135

    45

    Use Cases

    ! A use case is a pattern of behavior the system exhibits

    !Each use case is a sequence of related transactions performed byan actor and the system in a dialogue

    ! Actors are examined to determine their needs

    !Passenger Search for Flights, Make Reservation, Pay for Flight

    !Bank -- receive payment information from Pay for Flight

    Pay for FlightSearch for Flights Make Reservation

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    46/135

    46

    Documenting Use Cases

    ! A use case specification document is created for each usecases

    !Written from an actor point of view

    ! Details what the system must provide to the actor when the usecases is executed

    ! Typical contents

    !How the use case starts and ends

    !Normal flow of events

    !Alternate flow of events!Exceptional flow of events

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    47/135

    47

    Use Case Diagram

    Search for f l ight s

    Make r eservation

    Pay for Flight

    Select seat

    Passenger

    Bank

    Ext ension points

    Seat Selecti onextend

    Condition: {seat

    Selection available on flight}

    Extension point: Seat Selection

    Flight Reservation System

    include

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    48/135

    48

    UML 2.0 Changes

    ! No notational changes for use case diagrams in UML 2.0

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    49/135

    49

    UML 2.0 Diagrams

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachine

    Diagrams

    StateMachineDiagrams

    Composite

    StructureDiagrams

    CompositeStructure

    Diagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    Deployment

    Diagrams

    DeploymentDiagrams

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    50/135

    50

    Interaction Diagrams

    ! Interaction diagrams show the communication behaviorbetween parts of the system

    ! Four types of diagrams

    !Sequence diagram

    ! Emphasis on the sequence of communications between parts

    !Communication diagram

    ! Emphasis on structure and the communication paths betweenparts

    !Timing diagram

    ! Emphasis on change in state over time

    !Interaction overview diagram

    ! Emphasis on flow of control between interactions

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    51/135

    51

    Sequence Diagram

    : Customerreservation

    system

    reservation

    manager

    Make reservation

    Enter PIN

    verify PIN(number)

    Destination

    Ask for destination

    valid

    Destination

    Show flights (destination)

    destination

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    52/135

    52

    Framed Sequence Diagram

    : Customerreservationsystem

    reservationmanager

    destination

    Make reservation

    Enter PIN

    verify PIN(number)

    Destination

    Ask for destination

    valid

    Destination

    Show flights (destination)

    SD Make Reservation

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    53/135

    53

    : Customerreservationmanager

    destinationreservationsystem

    CheckPinref

    Composite Diagrams

    Make reservation

    Destination

    Ask for destination

    Destination

    Show flights (destination)

    SD Make Reservation

    reservationmanager

    verify PIN(number)

    valid

    : Customer reservationsystem

    Enter PIN

    SD Check PIN

    Enter PINverify PIN(number)

    valid

    IBM Software Group

    C bi d F T

  • 7/31/2019 IBM Introduction to UML 2

    54/135

    54

    Combined Fragment Types

    ! Alternatives (alt)

    !choice of behaviors at most one will execute

    !depends on the value of the guard (else guard supported)

    ! Option (opt)

    !Special case of alternative

    ! Loop (loop)

    !Optional guard: [, , ]

    !No guard means no specified limit

    ! Break (break)

    !Represents an alternative that is executed instead of the remainderof the fragment (like a break in a loop)

    IBM Software Group

    C bi d F T

  • 7/31/2019 IBM Introduction to UML 2

    55/135

    55

    Combined Fragment Types

    ! Parallel (par)

    !Concurrent (interleaved) sub-scenarios

    ! Negative (neg)

    !Identifies sequences that must not occur

    ! Assertion (assert)

    !This must happen

    ! Critical Region (region)

    !Traces cannot be interleaved with events on any of the participating

    lifelines

    IBM Software Group

    C bi d F t Di

  • 7/31/2019 IBM Introduction to UML 2

    56/135

    56

    alt

    Combined Fragments Diagram

    client: atm: dbase:

    insertCard

    CheckPinref

    [chk= OK]

    [else]error(badPIN)

    DoTransactionref

    SD Make Reservation

    IBM Software Group

    C i ti Di E l

  • 7/31/2019 IBM Introduction to UML 2

    57/135

    57

    Communication Diagram Example

    :Flight DB

    :WebServer

    :Web

    Client

    1approve

    flights

    1.1 approve

    flights1.2 confirm

    flights

    sd Reserve Flights

    1.3confir

    mflights

    2pay

    2.1receipt

    IBM Software Group

    Timing Diagram E ample

  • 7/31/2019 IBM Introduction to UML 2

    58/135

    58

    sdsd ReaderReader

    r : Reader

    t1

    Timing Diagram Example

    Reading

    Idle

    UninitializedInitialize

    Read ReadDone Read

    {d..d+0.5}

    {t1..t1+0.1}

    IBM Software Group

    I t ti O i E lsd OverviewDiagram lifelines Client, :Server

  • 7/31/2019 IBM Introduction to UML 2

    59/135

    59

    Interaction Overview Example

    ! Like flow charts

    ! Use activity graph notation for

    control constructs! Better overview of complex

    interactions

    ! Alternatives, options etc.

    ! Multiple diagram types couldbe included/referenced

    sd OverviewDiagram lifelines Client, :Server

    Authorizationref

    sd

    :Client:Client :Server:Server

    requestrequest

    DoMoreref

    [more]

    ~[more]

    IBM Software Group

    UML 2 0 Changes

  • 7/31/2019 IBM Introduction to UML 2

    60/135

    60

    UML 2.0 Changes

    ! Interaction occurrences and combined fragments added

    ! Communication diagrams created to replace collaborationdiagrams used to show interactions

    ! New diagrams: Timing Diagram and Interaction OverviewDiagram

    IBM Software Group

    UML 2 0 Diagrams

  • 7/31/2019 IBM Introduction to UML 2

    61/135

    61

    UML 2.0 Diagrams

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachineDiagrams

    StateMachineDiagrams

    CompositeStructureDiagrams

    CompositeStructure

    Diagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    Deployment

    Diagrams

    DeploymentDiagrams

    IBM Software Group

    Class Diagram

  • 7/31/2019 IBM Introduction to UML 2

    62/135

    62

    Class Diagram

    ! Class diagrams show static structure

    !This is the diagram that is used to generate code

    IBM Software Group

    Classes

  • 7/31/2019 IBM Introduction to UML 2

    63/135

    63

    Classes

    ! A class defines a set of objects with common structure,common behavior, common relationships and common

    semantics

    ! Classes can be discovered by examining the objects insequence and collaboration diagram

    !A class is drawn as a rectangle with three compartments

    ! Classes should be named using the vocabulary of the domain

    !Naming standards should be created

    !e.g., all classes are singular nouns starting with a capital letter

    IBM Software Group

    Classes

  • 7/31/2019 IBM Introduction to UML 2

    64/135

    64

    Classes

    PassengerInterface

    interfaceIPerson

    Mailer

    Reservation

    Seat

    Passenger

    CorporatePassenger

    Flight

    ReservationManager

    IBM Software Group

    Operations

  • 7/31/2019 IBM Introduction to UML 2

    65/135

    65

    Operations

    ! The behavior of a class is represented by its operations

    ! Operations may be found by examining interaction diagrams

    :ReservationManager :Reservation

    Assign seat row and position

    Reservation

    assignSeat(row, position)

    IBM Software Group

    Attributes

  • 7/31/2019 IBM Introduction to UML 2

    66/135

    66

    Attributes

    ! The structure of a class is represented by its attributes

    ! Attributes may be found by examining class definitions, theproblem requirements, business rules and by applying domainknowledge

    The name, address andphone number for eachperson is needed

    before a reservationcan be made

    Person

    name

    address

    phoneNumber

    IBM Software Group

    Classes with Operations and Attributes

  • 7/31/2019 IBM Introduction to UML 2

    67/135

    67

    Classes with Operations and Attributes

    PassengerInterface

    getName ( )getAddress ( )

    interfaceIPerson

    getName ( )

    getAddress ( )

    Mailer

    Reservation

    addItem ( )assignSeat ( )deleteSeat ( )

    Seat

    rowposition

    Passenger

    nameaddress

    CorporatePassenger

    discount

    Flight

    airlineflightNumber

    update( )

    ReservationManager

    IBM Software Group

    Relationships

  • 7/31/2019 IBM Introduction to UML 2

    68/135

    68

    Relationships

    ! Relationships provide a pathway for communication betweenobjects

    ! Sequence and/or communication diagrams are examined todetermine what links between objects need to exist toaccomplish the behavior -- if two objects need to talk theremust be a link between them

    ! Relationship types

    !Association

    !Aggregation

    !Composition

    !Dependency

    IBM Software Group

    Relationships

  • 7/31/2019 IBM Introduction to UML 2

    69/135

    69

    e at o s ps

    ! An association is a bi-directional connectionbetween classes

    ! An aggregation is a stronger form ofassociation where the relationship is betweena whole and its parts

    !A composition is a stronger form ofaggregation where the part is contained in atmost one whole and the whole is responsiblefor the creation of its parts

    ! A dependency is a weaker form ofrelationship showing a relationship between aclient and a supplier where the client does nothave semantic knowledge of the supplier

    IBM Software Group

    Finding Relationships

  • 7/31/2019 IBM Introduction to UML 2

    70/135

    70

    ReservationManager

    Reservation

    g p

    ! Relationships are discovered by examining interactiondiagrams

    !If two objects must talk there must be a pathway forcommunication

    :ReservationManager :Reservation

    Assign seat row and position

    IBM Software Group

    Relationships

  • 7/31/2019 IBM Introduction to UML 2

    71/135

    71

    p

    PassengerInterface

    getName ( )getAddress ( )

    interfaceIPerson

    getName ( )

    getAddress ( )

    Mailer

    Reservation

    addItem ( )assignSeat ( )deleteSeat ( )

    Seat

    rowposition

    Passenger

    nameaddress

    CorporatePassenger

    discount

    Flight

    airlineflightNumber

    update( )

    ReservationManager

    IBM Software Group

    Multiplicity and Navigation

  • 7/31/2019 IBM Introduction to UML 2

    72/135

    72

    p y g

    ! Multiplicity defines how many objects participate in arelationships

    !Multiplicity is the number of instances of one class related to ONEinstance of the other class

    !For each association and aggregation, there are two multiplicitydecisions to make: one for each end of the relationship

    ! Although associations and aggregations are bi-directional bydefault, it is often desirable to restrict navigation to onedirection

    !If navigation is restricted, an arrowhead is added to indicate thedirection of the navigation

    IBM Software Group

    Multiplicity

  • 7/31/2019 IBM Introduction to UML 2

    73/135

    73

    p y

    PassengerInterface

    getName ( )getAddress ( )

    interfaceIPerson

    getName ( )getAddress ( )

    Mailer

    Reservation

    addItem ( )assignSeat ( )deleteSeat ( )

    Seat

    rowposition

    Passenger

    nameaddress

    CorporatePassenger

    discount

    Flight

    airlineflightNumber

    update( )

    ReservationManager

    0..*

    1

    11

    1

    0..*

    IBM Software Group

    Navigation

  • 7/31/2019 IBM Introduction to UML 2

    74/135

    74

    PassengerInterface

    getName ( )getAddress ( )

    interfaceIPerson

    getName ( )getAddress ( )

    Mailer

    Reservation

    addItem ( )assignSeat ( )deleteSeat ( )

    Seat

    rowposition

    Passenger

    nameaddress

    CorporatePassenger

    discount

    Flight

    airlineflightNumber

    update( )

    ReservationManager

    0..*

    1

    11

    1

    0..*

    IBM Software Group

    Inheritance

  • 7/31/2019 IBM Introduction to UML 2

    75/135

    75

    ! Inheritance is a relationships between a superclass and itssubclasses

    ! There are two ways to find inheritance:

    !Generalization

    !Specialization

    ! Common attributes, operations, and/or relationships are shownat the highest applicable level in the hierarchy

    IBM Software Group

    Inheritance

  • 7/31/2019 IBM Introduction to UML 2

    76/135

    76

    PassengerInterface

    getName ( )getAddress ( )

    interfaceIPerson

    getName ( )getAddress ( )

    Mailer

    Reservation

    addItem ( )assignSeat ( )deleteSeat ( )

    Seat

    rowposition

    Passenger

    nameaddress

    CorporatePassenger

    discount

    Flight

    airlineflightNumber

    update( )

    ReservationManager

    0..*

    1

    11

    1

    0..*

    IBM Software Group

    Realization

  • 7/31/2019 IBM Introduction to UML 2

    77/135

    77

    ! Realization is a relationship between a specification and itsimplementation

  • 7/31/2019 IBM Introduction to UML 2

    78/135

    IBM Software Group

    UML 2 Interface Notation

  • 7/31/2019 IBM Introduction to UML 2

    79/135

    79

    PassengerInterface

    getName ( )getAddress ( )

    IPerson

    PassengerInterface is the implementation

    IPerson interface

    Mailer

    IPerson

    Mailer usesthe

    IPerson interface

    PassengerInterface

    getName ( )getAddress ( )

    Mailer

    IPerson

    IBM Software Group

    Realization

  • 7/31/2019 IBM Introduction to UML 2

    80/135

    80

    PassengerInterface

    getName ( )getAddress ( )

    Mailer

    Reservation

    addItem ( )assignSeat ( )deleteSeat ( )

    Seat

    rowposition

    Passenger

    nameaddress

    CorporatePassenger

    discount

    Flight

    airlineflightNumber

    update( )

    ReservationManager

    0..*

    1

    11

    1

    0..*

    IPerson

    IBM Software Group

    UML 2.0 Changes

  • 7/31/2019 IBM Introduction to UML 2

    81/135

    81

    ! Notation for a required interfaces ( ) added

    IBM Software Group

    UML 2.0 Diagrams

  • 7/31/2019 IBM Introduction to UML 2

    82/135

    82

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachineDiagrams

    StateMachineDiagrams

    CompositeStructure

    Diagrams

    CompositeStructure

    Diagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    DeploymentDiagrams

    DeploymentDiagrams

    IBM Software Group

    Composite Structure Diagrams

  • 7/31/2019 IBM Introduction to UML 2

    83/135

    83

    ! Composite Structure diagrams show the internal structure ofa classifier and its interaction points to other parts of the

    system!Instance view of the world

    ! They show how the contained parts work together to supply thebehavior of the container

    IBM Software Group

    Arent Class Diagrams Sufficient?

  • 7/31/2019 IBM Introduction to UML 2

    84/135

    84

    ! No!

    !Because they abstract out certain specifics, class diagrams arenot suitable for performance analysis

    ! Need to model structure at the instance/role level

    N1:NodeN1:Node N3:NodeN3:Node

    N4:NodeN4:Node

    N2:NodeN2:Node

    N2:NodeN2:NodeN1:NodeN1:Node N3:NodeN3:Node

    NodeNode

    left 0..1

    0..1

    right

    Same class diagramdescribes both systems!

    IBM Software Group

    Collaborations

  • 7/31/2019 IBM Introduction to UML 2

    85/135

    85

    RedundantSystem

    ! In UML 2.0 a collaboration is a purely structural concept

    !More general than an instance model

    arbiter:Arb

    arbiterarbiter:Arb:Arb

    primaryprimaryprimary

    clientclientclient backup1backup1backup1

    backup2backup2backup2

    collaborationcollaborationcollaboration

    connector(link role)

    connectorconnector(link role)(link role)

    rolerolerole

    1query 2b get

    2aget

    2cget

    associatedassociatedinteractioninteractionassociatedassociatedinteractioninteraction

    IBM Software Group

    Roles and Instances

  • 7/31/2019 IBM Introduction to UML 2

    86/135

    86

    ! Specific object instances playing specific the roles in acollaboration

    a/arbiter:Arba/a/arbiterarbiter:Arb:Arb

    d1/primary:Dbased1/primaryd1/primary:Dbase:Dbase

    c1/client:Clientc1/clientc1/client:Client:Client d2/backup1:Dbased2/backup1d2/backup1:Dbase:Dbase

    d2/backup2:Dbased2/backup2d2/backup2

    :Dbase:Dbase

    IBM Software Group

    Structured Class

  • 7/31/2019 IBM Introduction to UML 2

    87/135

    87

    ! A complex class comprised of internal parts

    ! Desired structure is asserted rather than constructed

    !Class constructor automatically creates desired structures

    !Class destructor automatically cleans up

    broker

    service

    client

    Class Name

    IBM Software Group

    Ports

  • 7/31/2019 IBM Introduction to UML 2

    88/135

    88

    PortsPorts

    ! Interaction points

    ! Each port is dedicated to a specific purpose and presents theinterface appropriate to that purpose

    IBM Software Group

    Port Semantics

  • 7/31/2019 IBM Introduction to UML 2

    89/135

    89

    ! A port can support multiple interface specifications! Provided interfaces (what the object can do) - incoming

    ! Required interfaces (what the object needs to do its job) -outgoing

    provides

    uses

    BuyTicket

    Request()Confirm()

    SellTicketProposal()

    Confirm()

    WebClientTicketServer

    uses

    provides

    IBM Software Group

    Ports: Alternative Notation

  • 7/31/2019 IBM Introduction to UML 2

    90/135

    90

    ! Shorthand lollipop notation with 1.x backward compatibility

    buyTicket

    WebClient

    sellTicket

    Required InterfaceRequired Interface

    Provided InterfaceProvided Interface

    IBM Software Group

    Assembling Communicating Objects

  • 7/31/2019 IBM Introduction to UML 2

    91/135

    91

    A connector is constrained by a protocolStatic typing rules apply (compatible protocols)

    Customer:WebClient

    Agency:

    TicketServer

    ! Ports can be joined by connectors to model communicationchannels

    !At runtime, the WebClient is linked to the TicketServer

    IBM Software Group

    Protocols: Reusable Interaction Sequences

  • 7/31/2019 IBM Introduction to UML 2

    92/135

    92

    ! Communication sequences that

    !Conform to a pre-defined dynamic order

    !Are defined generically in terms of role players

    !E.g., ticket purchase protocol

    propose

    WebClient TicketServer

    requestloop

    confirm

    confirm

    IBM Software Group

    Modeling Protocols with UML 2.0

  • 7/31/2019 IBM Introduction to UML 2

    93/135

    93

    ! A collaboration structure with interactions

    Ticket Purchase Protocol

    interfacebuyTicket

    interfacebuyTicket

    request( )Confirm()request( )Confirm()

    agencyagencycustomercustomer

    interfacesellTicket

    interfacesellTicket

    Propose()Confirm()Propose()Confirm()

    propose

    WebClient TicketServer

    requestloop

    confirm

    confirm

    IBM Software Group

    Structured Classes: Putting Them Together

  • 7/31/2019 IBM Introduction to UML 2

    94/135

    94

    OnlineAgency

    Customer:

    WebClient

    Agency:

    TicketServer

    sd

    ReserveFlights

    sd

    SelectFlights

    IBM Software Group

    Structured Classes: Putting Them Together

  • 7/31/2019 IBM Introduction to UML 2

    95/135

    95

    OnlineAgency

    Customer:

    WebClient

    Agency:

    TicketServer

    sd

    ReserveFlights

    sd

    SelectFlights

    AirlineTicketReservation

    sd sd

    IBM Software Group

    UML 2.0 Changes

  • 7/31/2019 IBM Introduction to UML 2

    96/135

    96

    ! Composite structure diagrams, structured classes, ports andconnectors are new

    IBM Software Group

    UML 2.0 Diagrams

  • 7/31/2019 IBM Introduction to UML 2

    97/135

    97

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachineDiagrams

    StateMachineDiagrams

    CompositeStructure

    Diagrams

    CompositeStructureDiagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    DeploymentDiagrams

    DeploymentDiagrams

    IBM Software Group

    State Machine Diagram

  • 7/31/2019 IBM Introduction to UML 2

    98/135

    98

    ! A state machine diagram shows

    !The life history of a given class

    !The events that cause a transition from one state to another

    !The actions that result from a state change

    ! State machine diagrams are created for objects with significant

    dynamic behavior

    IBM Software Group

    State Diagram

    state machine Make Payment

  • 7/31/2019 IBM Introduction to UML 2

    99/135

    99

    Enter creditcard data

    Do transaction:Payment Transaction

    Display

    Confirmation PageDisplay

    Cancellation Page

    OK aborted

    done

    cancel

    y

    IBM Software Group

    Submachine

    Payment Transaction

  • 7/31/2019 IBM Introduction to UML 2

    100/135

    100

    User confirmation

    For amount

    Authorize

    transaction

    Enter PIN

    Authorize

    PIN

    OK

    PIN required

    OK

    Transaction

    not authorized

    PIN rejected

    Transaction

    confirmed

    PIN confirmed

    OK

    aborted

    Payment Transaction

    IBM Software Group

    Specialization

    ! Redefinition as part of standard class specialization

  • 7/31/2019 IBM Introduction to UML 2

    101/135

    101

    p p

    ATM

    acceptCard()outOfService()amount()

    Behaviour

    Statemachine

    FlexibleATM

    otherAmount()rejectTransaction()

    Behaviour

    Statemachine

    IBM Software Group

    Example: State Machine Redefinition

  • 7/31/2019 IBM Introduction to UML 2

    102/135

    102

    ! State machine of ATM to be redefinedVerifyCard

    ReadAmount

    selectAmount

    acceptCard

    ReleaseCardVerifyTransaction

    selectAmount

    amount

    outOfService

    releaseCard

    OutOfService

    ATM

    {final}

    {final}

    {final}

    {final}

    IBM Software Group

    State Machine Redefinition

  • 7/31/2019 IBM Introduction to UML 2

    103/135

    103

    VerifyCard

    acceptCard

    ReleaseCardVerifyTransaction

    outOfService

    releaseCard

    OutOfService

    ATM

    {final}

    {final}

    {final}

    {final}

    ReadAmount

    selectAmount

    amount enterAmount

    okreject

    {extended}

    otherAmount

    {extended}

    FlexibleATM

    IBM Software Group

    UML 2.0 Changes

  • 7/31/2019 IBM Introduction to UML 2

    104/135

    104

    ! Protocol state machines added

    IBM Software Group

    UML 2.0 Diagrams

    I t ti

    U

  • 7/31/2019 IBM Introduction to UML 2

    105/135

    105

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachineDiagrams

    StateMachineDiagrams

    CompositeStructure

    Diagrams

    CompositeStructureDiagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    DeploymentDiagrams

    DeploymentDiagrams

    IBM Software Group

    Component Diagram

  • 7/31/2019 IBM Introduction to UML 2

    106/135

    106

    ! A component is a modular unit with well defined interfacesthat is replaceable within its environment

    ! Components can be logical or physical

    ! Logical components

    !Business components, process components etc.

    ! Physical components!EJB components, .NET components, COM components etc.

    IBM Software Group

    Component Diagram

  • 7/31/2019 IBM Introduction to UML 2

    107/135

    107

    IPerson

    :Reservation :Passenger

    :Ticket

    IBM Software Group

    UML 2.0 Changes

  • 7/31/2019 IBM Introduction to UML 2

    108/135

    108

    ! Notation for a component changed

    ! Component may have ports

    IBM Software Group

    UML 2.0 Diagrams

    I t ti

    Interaction

    U

    Use

  • 7/31/2019 IBM Introduction to UML 2

    109/135

    109

    ComponentDiagrams

    ComponentDiagrams

    InteractionDiagrams

    InteractionDiagrams

    StateMachineDiagrams

    StateMachineDiagrams

    CompositeStructure

    Diagrams

    CompositeStructureDiagrams

    ClassDiagrams

    ClassDiagrams

    UseCase

    Diagrams

    UseCase

    Diagrams

    ActivityDiagrams

    ActivityDiagrams

    DeploymentDiagrams

    DeploymentDiagrams

    IBM Software Group

    Deployment Diagram

  • 7/31/2019 IBM Introduction to UML 2

    110/135

    110

    ! Deployment diagrams show the execution architecture ofsystems

    ! Nodes are connected by communication paths to createnetwork systems

    IBM Software Group

    Artifacts

    A if h i l i

  • 7/31/2019 IBM Introduction to UML 2

    111/135

    111

    ! An artifact represents a physical entity

    ! Examples

    !Model files, source files, scripts, binary executable files

    :Ticket

    Ticket.jar

    IBM Software Group

    Deployment Diagram

  • 7/31/2019 IBM Introduction to UML 2

    112/135

    112

    AppServer DB Server

    Ticket.jar

    IBM Software Group

    UML 2.0 Changes

    A tif t d d l t ifi ti

  • 7/31/2019 IBM Introduction to UML 2

    113/135

    113

    ! Artifacts and deployment specifications are new

    ! New Node types introduced

    !Execution environment (virtual machine, app server, and othermiddleware)

    IBM Software Group

    Agenda

    ! The Importance of Modeling

  • 7/31/2019 IBM Introduction to UML 2

    114/135

    114

    ! The Importance of Modeling

    ! The Unified Modeling Language

    ! UML Diagrams

    ! Extending the UML

    IBM Software Group

    Extending the UML

    ! In order to model something effectively the language that you

  • 7/31/2019 IBM Introduction to UML 2

    115/135

    115

    ! In order to model something effectively, the language that youuse to model it must be rich and expressive enough to do so

    !Out of the box UML is sufficient for modeling object-orientedsoftware systems

    ! BUT there are many more models that are useful in thesoftware development process

    ! UML can easily be extended to add more semantics to coverother modeling situations

    !Database models

    !Business process

    !Web pages

    !On and on.

    IBM Software Group

    Extension Mechanisms

    ! Stereotypes

  • 7/31/2019 IBM Introduction to UML 2

    116/135

    116

    ! Stereotypes

    ! Tag definitions and tagged values

    ! Constraints

    IBM Software Group

    Stereotypes

    ! A more refined semantic interpretation for a model element

  • 7/31/2019 IBM Introduction to UML 2

    117/135

    117

    ! A more refined semantic interpretation for a model element

    Class

    Table

    IBM Software Group

    Stereotype Examples

  • 7/31/2019 IBM Introduction to UML 2

    118/135

    118

    IBM Software Group

    Deployment Diagram

  • 7/31/2019 IBM Introduction to UML 2

    119/135

    119

    IBM Software Group

    Tag Definitions and Tagged Values

    ! A tag definition the ability to associate extra information with

  • 7/31/2019 IBM Introduction to UML 2

    120/135

    120

    tag de t o t e ab ty to assoc ate e t a o at o ta modeling element

    !Defines the name and the type of information

    ! Example

    !A database table could be modeled as a stereotyped class

    !Columns could be modeled as stereotyped attributes

    !Tag definition for a column could be NullsAllowed

    ! A tagged value is the actual instance of a tag definition with avalue that is associated to the modeling element

    !

    Example!Create a table Person

    !Add a column, you MUST supply a value for NullsAllowed (true orfalse)

    IBM Software Group

    Constraints

    ! A constraint is a rule that is applied to a modeling element

  • 7/31/2019 IBM Introduction to UML 2

    121/135

    121

    A constraint is a rule that is applied to a modeling element

    !Represented by curly braces in UML

    ! Used to evaluate if a modeling element is well-formed

    ! Example

    !The name of a column cannot exceed the maximum length for

    column names for the associated database! The language of constraints is Object Constraint Language

    (OCL)

    IBM Software Group

    OCL

    ! OCL is another OMG specification

  • 7/31/2019 IBM Introduction to UML 2

    122/135

    122

    p

    ! Defines an object-oriented language that is similar to

    Smalltalk, Java and C++! Formal way to express model well formedness rules

    {let x = self.model().OwnedProfile->any(Name='Data Modeler').TaggedValueSet->any(Name='Preferences').TagDefinition->any(Name='maximumidentifierlength').DefaultValue.oclAsType(UML::IntegerTaggedValue).Value in self.Name.size()

  • 7/31/2019 IBM Introduction to UML 2

    123/135

    123

    p yp , gconstraints that work together to define new semantics for amodel

    ! Example

    !Data modeling profile

    !Business modeling profile

    !EJB profile

    IBM Software Group

    EJB Profile

  • 7/31/2019 IBM Introduction to UML 2

    124/135

    124

    IBM Software Group

    Specializing UML

    ! Lightweight extensions

  • 7/31/2019 IBM Introduction to UML 2

    125/135

    125

    !Extend semantics of existing UML concepts by specialization

    !Conform to standard UML (tool compatibility)!Profiles, stereotypes

    ! Heavyweight (MOF) extensions

    !

    Add new non-conformant concepts or!Incompatible change to existing UML semantics/concepts

    Standard UML Semantics

    LightweightLightweight

    extensionextension

    HeavyweightHeavyweight

    extension Mextension M

    IBM Software Group

    The Profile-Based Approach to DSLs

    ! Profile = a compatible specialization of an existing modeling

  • 7/31/2019 IBM Introduction to UML 2

    126/135

    126

    language by

    !

    Adding constraints, characteristics, new semantics to existinglanguage constructs

    !Hiding unused language constructs

    ! Advantages:

    !Supported by the same tools that support the base language

    !Reuse of base language knowledge, experience, artifacts

    ! Example: ITU-T standard language SDL (Z.100)

    !Modeling language used in telecom applications

    !Now defined as a UML profile (Z.109)

    IBM Software Group

    UML Profile Example

    ! Defining a customclock stereotype

    UML base concepts

    (metamodel)

  • 7/31/2019 IBM Introduction to UML 2

    127/135

    127

    ClockClock

    UML::Class UML::AttributeUML::Attribute

    ClockValueClockValue

    *

    {type = Integer,

    value >= 0}{has exactlyone ClockValueAttribute}

    Semantics:

    changes valuesynchronously with theprogress of physical time

    Stereotypes

    IBM Software Group

    Profiles: Notation

    ! E.g., specializing the standard Component concept

    profileprofile TimingDevicesTimingDevices

  • 7/31/2019 IBM Introduction to UML 2

    128/135

    128

    profileprofile TimingDevicesTimingDevices

    stereotypestereotypeClockClock

    metaclassmetaclassClassClass

    stereotypestereotype

    TimerTimer

    stereotypestereotype

    ToDclockToDclock

    ExtensionExtension

    IBM Software Group

    Templates

    ! More precise model than UML 1.x

  • 7/31/2019 IBM Introduction to UML 2

    129/135

    129

    ! Limited to Classifiers, Packages, and Operations

    NumericArrayNumericArray

    arrayElementarrayElement : T [k]: T [k]

    T > Number, k :T > Number, k : IntegerExpressionIntegerExpression

    TemplateTemplatesignaturesignature

    IntegerArrayIntegerArray

    arrayElementarrayElement : Integer [10]: Integer [10]

    bind Integer, k --> 10>> 10>

    TemplateTemplate

    bindingbinding

    BoundBoundclassclass

    TemplateTemplateparameterparameter

    Class(ifierClass(ifier))

    templatetemplate

    IBM Software Group

    Collaboration Templates

    ! Useful for capturing design patternsObserverPatternObserverPattern

    oTypeoType sTypesType

  • 7/31/2019 IBM Introduction to UML 2

    130/135

    130

    subject :subject : sTypesType observer :observer : oTypeoType

    oTypeoType,, sTypesType

    ObserverPatternObserverPattern DevicePollerDevicePoller,, sTypesType>Device>>Device>

    DeviceObserverDeviceObserver

    bindbind

    CollaborationCollaborationtemplatetemplate

    IBM Software Group

    Package Templates

    !

    Based on simple string substitutionCustomerAccountTemplate

    CustomerAccountTemplateCustomerAccountTemplate

    customer :customer : StringExpressionStringExpression,,kind :kind : StringExpressionStringExpression

  • 7/31/2019 IBM Introduction to UML 2

    131/135

    131

    $$$$$$ $Account$$$

    Account$Account$$Acct$$Acct$

    0..*0..*ownerowner

    1..*1..*

    SavingsBankSavingsBankSavingsBank

    PersonPersonPersonPersonalAccountPersonalPersonalAccountAccount

    PersonalAcctPersonalAcct

    0..*0..*

    ownerowner

    1..*1..*

    bind Person,kindkind --> Personal> Personal

    NameNameExpressionExpression

    IBM Software Group

    Summary: UML 2.0 Highlights

    ! Greatly increased level of precision to better support MDD

    !M i d fi iti f t d th i l ti hi

  • 7/31/2019 IBM Introduction to UML 2

    132/135

    132

    !More precise definition of concepts and their relationships

    !Extended and refined definition of semantics

    ! Improved language organization

    !Modularized structure

    !Simplified compliance model for easier interworking

    ! Improved support for modeling large-scale software systems!Modeling of complex software structures (architectural description language)

    !Modeling of complex end-to-end behavior

    !Modeling of distributed, concurrent process flows (e.g., business processes,

    complex signal processing flows)

    ! Improved support for defining domain-specific languages (DSLs)

    ! Consolidation and rationalization of existing concepts

    IBM Software Group

    Session Summary

    ! Now that you have completed this session, you should be ableto:

  • 7/31/2019 IBM Introduction to UML 2

    133/135

    133

    to:

    !Identify the different UML diagrams

    !Describe the purpose of each diagram

    !Use the different diagram and model elements

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    134/135

    134

    IBM Software Group

  • 7/31/2019 IBM Introduction to UML 2

    135/135

    135