Rpl Lect05 2010 Uml

Embed Size (px)

Citation preview

  • 7/31/2019 Rpl Lect05 2010 Uml

    1/27

    Software EngineeringLecture 7Introduction to Unified Modelling

    Language (UML)

    Dr. Ir. Riri Fitri Sari MM MSc

    4 October 2010

    Faculty of Engineering

    University of Indonesia

  • 7/31/2019 Rpl Lect05 2010 Uml

    2/27

    ELH71413

    2

    Learning Objective By the end of this lecture you should:

    Be able to explain what UML is, where it came from andwhere its going.

    Be familiar with each of the Nine UML Diagrams

    Be familiar with UML packages and stereotypes

    Appreciate how UML diagrams may be used together toconstruct multiple views of a system.

    UML - Introduction and Overview

    StudentLearn about UML

    Topic 1

    This material is based on OOSE, Owen, University of Leeds, 2002.

  • 7/31/2019 Rpl Lect05 2010 Uml

    3/27

    ELH71413

    3

    What is a Diagram?

    Definition: Abstract shapes

    are used to represent things or actions

    from the real world.

    Diagrams follow rules and standards

    The standards make sure that differentpeople will interpret the diagram in the same

    way

    40

    Source: OO Analysis and Design with UML, Bennett, McRobb and Farmer, 2002.

  • 7/31/2019 Rpl Lect05 2010 Uml

    4/27

    ELH71413

    4

    On their own Diagrams provide a convenient abstraction

    to clarify ones own understanding

    to show to others for discussion, debate and clarification

    to provide high level documentation

    Diagrams are used to communicate information to people.

    Diagrams should therefore be clear, simple, unambiguous.

    - i.e. They should follow rules!

    UML defines a Language, i.e. the rules, for drawing diagrams of computersystems to avoid ambiguity between developers.

    UML rules include the flexibilityto keep diagrams clear and simple by

    showing only what needs to be shown.

    Whats the point of

    Diagrams?

  • 7/31/2019 Rpl Lect05 2010 Uml

    5/27

    ELH71413

    5

    Introduction to UML

    UML - Unified Modelling Language- Unified

    - Modelling

    - Language

    - The UML is a set of different diagram typesthat can be used alone or together

    to describe all or part of a system.

    -Each diagram type can be used to describe a system

    - from a particular perspective

    e.g. classes show a logical view of the system

  • 7/31/2019 Rpl Lect05 2010 Uml

    6/27

    ELH71413

    6

    UML to reduce ambiguity

    Order

    Item

    Ship via

    1) A Visually Rich but ambiguous diagram.

    2) A UML Activity Diagram

    describing the same flow

    of events.

    Customerrequests Item

    Salesmanagrees sale

    Item preparedfor shipping

    Item shippedby Rail

    Item Shippedby Road

    Item Receivedby Customer

    U M Language

  • 7/31/2019 Rpl Lect05 2010 Uml

    7/27

    ELH71413

    7

    Together We can use a set of diagrams to describe different

    aspects of a system.

    at different levels of abstraction

    to examine specific aspects in detail

    for different perspectives on the same system

    to model the views of a system in terms of

    Requirement

    Logical

    Dynamic and

    Physical views

    U M LanguageWhats the point of

    Diagrams II?

  • 7/31/2019 Rpl Lect05 2010 Uml

    8/27

    ELH71413

    8

    UML is Flexible

    at different levels of abstraction1) A Valid UML Class

    Ant

    2) An equally valid alternativediagram for the same UML

    Class.

    Ant

    - currentPosition_X: Integer

    - currentPosition_Y: Integer

    - direction: Integer

    - speed: Integer

    - haveFood: Boolean

    - knownFoodPosition_X: Integer

    - knownFoodPosition_Y: Integer

    + newAnt()

    + drawAnt()

    + tellFoodLocation()

    + askFoodLocation()

    + moveAnt()

    - goToFood()

    - search ForFood()

    - carryFoodToNest()

    Key Point

    Users of UML should work at

    a level of abstraction

    appropriate to what they are

    trying to communicate.

    U M Language

  • 7/31/2019 Rpl Lect05 2010 Uml

    9/27

    ELH71413

    9

    UML is Flexible

    Examining specific aspects in detail

    Write Chapter

    Review Chapter

    Author PrinterTypesetterReviewer

    Typeset Book

    Correct Proofs

    Reset Book

    Print Book

    [book complete]

    [book not

    complete]

    Revise Chapter

    Plan Chapter

    Produce

    First Draft

    Revise Draft

    [satisfied]

    [not satisfied]

    Add Exercises

    Add References

    to Bibliography

    Write Chapter

    Source: OO Analysis and Design with UML, Bennett, McRobb and Farmer, 2002.

    U M Language

  • 7/31/2019 Rpl Lect05 2010 Uml

    10/27

    ELH71413

    10

    Domain Model: The RUP - Where it came from and where its going.

    IBM

    International Consortium

    Object Management Group

    (OMG)

    Microsoft

    Is managed by

    is a member of..

    is a member of..

    Unified

    Modelling

    Language(UML)

    Software Engineering

    Key to UMLIs related to

    Is a type of

    Organisations are stereotypedwith blue class boxes.

    RAD

    Iterative/prototyping

    method

    Booch Method

    Objectoriented

    method

    Rumbaughs OMT

    Jacobsons Use Cases

    Development

    method

    Based on a

    TheMicrosoft

    Framework

    bought by...

    Rational

    Software

    Corporation

    unified process

    (UP)

    Rational

    Unified

    Process

    (RUP)

    SSADM

    Waterfalldevelopment

    Method

  • 7/31/2019 Rpl Lect05 2010 Uml

    11/27

    ELH71413

    11

    History of UMLBooch Method Rumbaughs OMT1995

    Unified Method 0.8OOPSLA 10/95 Jacobsons Use CasesOther Methods

    UML 0.91996 UML patterners input

    UML 1.0OMG Submission 1/97

    UML 1.1OMG Adoption 11/97

    UML 1.3

    RTF Report 1999

    UML 1.42001

    UML 2.0Major new release 2004?

    UML 1.52003

    3

  • 7/31/2019 Rpl Lect05 2010 Uml

    12/27

    ELH71413

    12

    Key Points about UML Its a set of diagrams with notation rules.

    Diagrams can be used in problem solving. UML is controlled by an independent standards body - the Object

    Management Group (OMG) - www.omg.org

    UML is now firmly established as the de facto world standard.

    UML has it historical roots in OO Systems Development

    BUT... as a world standard for diagram notation its potentially valuable

    to

    any systems development effort

    any problem solving effort where drawing diagrams helps

    For an early history of UML read Chris Korbyns paper

    UML 2001: A Standardization Odyssey (1999)

    www.omg.org/attachments/pdf/UML_2001_CACM_Oct99_p29-Kobryn.pdf

    Unified Modelling Language

    ELH71413

    http://www.omg.org/attachments/pdf/UML_2001_CACM_Oct99_p29-Kobryn.pdfhttp://www.omg.org/http://www.omg.org/attachments/pdf/UML_2001_CACM_Oct99_p29-Kobryn.pdfhttp://www.omg.org/attachments/pdf/UML_2001_CACM_Oct99_p29-Kobryn.pdfhttp://www.omg.org/attachments/pdf/UML_2001_CACM_Oct99_p29-Kobryn.pdfhttp://www.omg.org/attachments/pdf/UML_2001_CACM_Oct99_p29-Kobryn.pdfhttp://www.omg.org/
  • 7/31/2019 Rpl Lect05 2010 Uml

    13/27

    ELH71413

    13

    The Nine UML Diagrams

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    14/27

    ELH71413

    14

    Use Case Diagrams

    These diagrams show the users and what functions the system

    must provide for them.

    The functions are described as transactions of value.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    Sales

    Coordinator

    Sales

    Manager

    Review Sales Performance

    Add a Customer

    Update Customer Details

    Take a Customer Booking

    Review StaffPerformance

    Booking Sales System

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    15/27

    ELH71413

    15

    Class Diagrams

    Class diagrams present the static (logical) structure of the system.

    They are the core of the UML notation and of an object-oriented

    design.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    Customer

    Corporate

    Customer

    Customer

    Contact

    Event

    Booking

    Item

    required for

    Booking

    Internal

    Customer

    Room

    Venue Stock Items

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    16/27

    ELH71413

    16

    Object Diagrams

    An Example of an Object Diagram

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    Basically the same as a Class diagram but showing single

    Object Instances and their relationships rather than Classes.

    Used to describe the Objects in a Scenario.

    Bob :Author

    Name = Bob J.

    Age = 32

    Bobs Work

    PC :Computer

    name = Dell 466

    memory = 64

    Bobs Home

    PC :Computer

    name = Compaq

    Pentium MMX

    memory = 128

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    17/27

    ELH71413

    17

    Collaboration Diagrams

    Note that these are Object Diagrams with added message arrows to

    show the messages.

    These diagrams show the sequence of message sent betweencollaborating objects for a particular task or scenario.

    The diagrams highlight the relationships between the collaborating

    objects.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    :Customer:Customer

    Contact

    SalesCoordinator

    1. Add Customer() 2. Add Contact()

    3. Confirm Details()

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    18/27

    ELH71413

    18

    Sequence Diagrams

    These diagrams show the sequence of message sent

    between collaborating objects for a particular task or scenario.

    They highlight the flow of control between the objects.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    Add Customer()

    Add Contact()

    Confirm Details()

    :Customer:Customer

    Contact

    Sales

    Coordinator

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    19/27

    ELH71413

    19

    Notation ofInteraction Diagrams

    (Sequence and Collaboration Diagrams)CASE tools like Rational Rose allow you to generate collaboration

    diagrams from sequence diagrams (and vice versa).

    The diagrams show the same information but using different notation.

    Add Customer()

    Add Contact()

    Confirm Details()

    :Customer:Customer

    Contact

    Sales

    Coordinator

    :Customer:Customer

    Contact

    Sales

    Coordinator

    1. Add Customer() 2. Add Contact()

    3. Confirm Details()

    Messages are numbered

    Messages are arranged vertically over ti

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    20/27

    ELH71413

    20

    State Diagrams

    A Statechart, (or state, or state

    transition diagram) illustrates the

    states an object can be in and thetransitions which move the object

    between these states.

    Guard Conditions using [square

    brackets] determinewhich transitions are possible.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    Provisional

    Confirmed

    Complete

    Invoiced

    Cancelled

    [Deposit received]

    [Cancelled]

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    21/27

    ELH71413

    21

    Activity Diagrams

    These diagrams describe the

    flow of activities or tasks.

    They are basically just flow

    charts!

    They have

    - decision points

    - synchronisation bars

    The synchronisation bars show

    activities that can happen in

    either order or even at the

    same time.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    [No]

    Check availability

    Get a quote Make a Provisional

    Booking

    Pay Deposit

    Attend Event

    Pay Balance

    Cancel?

    [Yes]

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    22/27

    ELH71413

    22

    Notation of Transition Diagrams

    (Activity and State Diagrams)

    Start state

    black circle

    Decision points diamond

    Guard conditions

    in square brackets

    Final state

    black circle in white circle

    [campaign to add]

    [no campaign to add]

    Add a New

    Client

    Assign Staff

    Contact

    Add New

    Campaign

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    23/27

    3

    23

    Component Diagrams

    Component diagrams illustrate the physical structure ofthe system in terms of its Software. They show the

    software components and the dependencies between

    them.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    Salesperson Diary &

    ContactsCustomer Database

    Event Booking

    User Interface Events System

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    24/27

    24

    Deployment Diagrams

    Deployment diagrams illustrate the physical architecture of

    the system in terms of the Hardware it is deployed on and

    the communication links between hardware nodes.

    Use Case

    Class

    Activity

    State Sequence

    Collaboration

    ObjectComponent

    Deployment

    :Salespersons PC :Booking Server

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    25/27

    25

    Implementation Diagrams

    - Component and Deployment Diagrams together

    Heres an example where a Deployment Diagram shows thephysical deployment of the implementation Components.

    It shows how and where the components will be implemented,

    including the dependencies between components that are

    physically on different nodes.

    :Salespersons PC :Booking Server

    Customer

    Database

    Salespers

    on Diary

    &

    Contacts

    Event

    Booking

    User

    Interface

    Events

    System

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    26/27

    26

    PackagesA Package is a UML container which can contain one or more similarentities

    Objects, Classes, Components, Diagrams and other Packages

    Packages provide a way of organising large scale models

    Package

    ELH71413

  • 7/31/2019 Rpl Lect05 2010 Uml

    27/27

    27

    StereotypingUML includes a feature called stereotypes which enable users to

    create their own UML symbols.

    A stereotype can be drawn using guillemets, e.g. >

    OR a Picture can be used instead:

    >

    Deployment Diagram: A two PC Network

    Key Point - This picture is a valid UML diagram provided that TCP/IP has beendeclared as a stereotype for a deployment diagram communication association

    and that the picture of the PC has been declared as a stereotype for a Network

    PC Deployment node.