UML for Designers

Embed Size (px)

Citation preview

  • 7/29/2019 UML for Designers

    1/35

    Prepared by Jayashree Kar

    July 2004, Wipro Technologies

    UML Diagrams for Designers

    A P R E S E N T A T I O N B Y

    W I P R O T E C H N O L O G I E S

    Prepared by:

    Jayashree Kar

    Architect,

    Corporate Vertical

    Wipro Technologies

    Aug, 2004

  • 7/29/2019 UML for Designers

    2/35

    23 Jun 2004 Wipro Confidential 2

    What is UML?

    UML stands for Unified Modeling Language.

    UML is a set of standard notations used for modeling object oriented systems.

    UML has evolved through the work of Grady Booch, James Rumbaugh, Ivar Jacobson andRational Software Corporation.

    UML helps to specify, visualize and document models representing systems.

    UML is a industry standard for modeling application systems.

    UML model is methodology independent; i.e. UML can be mapped for all the widespread

    methodologies.

    UML model can platform independent.

    UML model be either Programming language specific or independent..

    UML has been accepted by Object Management Group (OMG) as the standard for modeling

    OO systems.

    UML is the foundation ofOMGs model driven architecture (MDA).

    be either hardware and software platform specific or hardware and software

  • 7/29/2019 UML for Designers

    3/35

    23 Jun 2004 Wipro Confidential 3

    Why UML Modeling?

    Modeling is a highly creative process through which a solution is created iterating through

    the requirements.

    Provides standardization of models across the industry.

    Provides common language to Architects, developers and business users.

    Human brain is more receptive to pictures than texts; hence models convey lot more than

    pages of text.

    Modeling is essential part of large projects and is useful for small and medium size projects.

    UML provides support in each phase of OOAD software life cycle.

    Provides support for taking a holistic view of the system through the various models

    representing logical, implementation, deployment, process and use case views.

    Supports model driven architecture (MDA).

    Enhances speed of project by providing code generation from the model.

    Reverse engineering features of the modeling tool helps in understanding the existing

    systems.

    Has support for platform specific (PSM) as well as platform independent models (PIM)

  • 7/29/2019 UML for Designers

    4/35

    23 Jun 2004 Wipro Confidential 4

    UML: Various Views

    Implementationview

    Deployment

    View

    ProcessView

    Logical view Use case view

    Contains classes,

    interfaces, etc.

    Logical view is for product

    designers

    Contains components, APIs etc

    Implementation view is for component designers

    Contains node, network

    connectivity etc.

    Deployment view is for

    system administrators

    Contains system boundary, use cases, actors etc.

    Use case view is for all the stakeholders of the system

    Contains processes, activities etc.

    Process view is for business

    owners

  • 7/29/2019 UML for Designers

    5/35

    23 Jun 2004 Wipro Confidential 5

    UML Diagrams - Overview

    UML defines Nine types of standard diagrams. They are as follows:

    Structural diagram

    Class

    Object

    Component

    Deployment

    Behavioral diagram

    Use case

    Sequence

    Collaboration

    Activity

    State-chart

    In addition, the following are used for model management: Model Management diagram

    Package

    Subsystem

    Model

  • 7/29/2019 UML for Designers

    6/35

    23 Jun 2004 Wipro Confidential 6

    UML Diagrams

    Structural Diagram

    UML Diagram Description

    Class This is the most important diagram in OO design. It represents the staticbehavior of the system.

    Object These describe the static structure of a system at a particular time. This is used

    for modeling the pilots projects. This is also used for validating the model.

    Component These diagrams describe the organization of physical software components,

    including source code, run-time (binary) code, and executables. This diagram

    provides overview of various separable pieces.

    Deployment These diagrams depict the physical resources in a system, including nodes,

    components, and connections. This is used by the systems administrator who

    install and/or maintain the systems. This is used to depict the disaster recovery

    sites and alternate sites as well.

  • 7/29/2019 UML for Designers

    7/3523 Jun 2004 Wipro Confidential 7

    UML Diagrams

    Behavioral Diagram

    UML Diagram Description

    Use case This is the most important model used for the Object oriented analysis. Thisdenotes functionality of system using actors and use cases.This is also used for

    understanding the boundary of the system.

    Interaction diagram

    (Sequence)

    This is used for modeling the dynamic behavior of the system. This is used to

    describe interactions among classes in terms of an exchange of messages over

    time.

    Interaction diagram

    (Collaboration)

    Collaboration diagrams represent interactions between objects as a series of

    sequenced messages. Collaboration diagrams can describe both the static

    structure and the dynamic behavior of a system. Most of the tools can convertsequence diagram to collaboration and vice versa.

    State machine These diagrams describes the dynamic behavior of a system in response to

    external events. This diagram is created for the state machines implemented by

    the system. This is also useful in modeling reactive objects whose states are

    triggered by specific events.

    Activity These diagrams illustrate the dynamic nature of a system by modeling the flow

    of control from activity to activity. An activity represents an operation on some

    class in the system that results in a change in the state of the system. Typically,activity diagrams are used to model workflow or business processes and

    internal operation. Swim lanes in activity diagram are used to denote

    segregation of processes conducted by various organizations.

  • 7/29/2019 UML for Designers

    8/3523 Jun 2004 Wipro Confidential 8

    UML Diagrams

    Model Management Diagram

    UML Diagram Description

    Package This is used to organize elements of a system into related groups to minimize

    dependencies between packages.

    Package diagram can be used with class diagrams to logically group the

    classes.

    They are also used to group the use cases.

    Subsystem This helps to manage the system and the model.

    Model Model properties help understand the model items properly.

  • 7/29/2019 UML for Designers

    9/35

  • 7/29/2019 UML for Designers

    10/3523 Jun 2004 Wipro Confidential 10

    Class Diagram/ Package Diagram

    Class diagram is the most important class for representing logic model of the system

    Symbols/

    Notation

    Description

    class A class is represented by symbol.

    It denotes a particular type of Objects. It has attributes and

    operations that define the Property of the class.

    Package A package is represented by the symbol.

    It denotes a logical Group of classes. Since the visibility of class, its attributes And

    operations can be defined at package level, proper Package definition is important to reduce

    dependencies.

    Association Association is represented by a line with arrowhead. It denotes conceptual relationship

    between two classes. A class may have some attributes due to its association with the other

    class. The association can be attached to a class; called associationclass

    Aggregation Aggregation is a special type of association where the one class forms the part and the

    other forms the whole. In aggregation relationship, the parts are shared across wholes.

    Cardinality/

    Multiplicity

    Multiplicity is used with associations to represent how the objects are related. Associations

    can be mandatory, optional, many to many, one to many etc.

    Insurance

    C1 C2

    House Window

    House Window

    1..n1..n

  • 7/29/2019 UML for Designers

    11/3523 Jun 2004 Wipro Confidential 11

    Class Diagram/ Package Diagram

    Class diagram is the most important class for representing logic model of the system

    Symbols/

    Notation

    Description

    Composition Composition is very similar to aggregation and associates part and whole classes buthere the whole class takes care of creating and destroying the part hence the part isnot shared.

    Active classes Active class is a special type of class that owns an execution thread to initiate controlactivity. It executes itself concurrently till it is completed/ terminated by an external

    force. Passive class has instances that can execute only when another class performssome operation on it. It is either implemented by a process or a thread.

    Generalization/Specialization

    If a class is specialized that means it is inherited from a generalized class. A corporatecustomer is a specialization of customer class where it inherits the properties(attributes and operations) and can have extra properties of its own. It can overridesome of the properties as well.

    Dependency In this the dependent class changes when the class it is depending upon, changes.

    Visibility The attributes and operations in a class can be private, public or protected. Dependingupon the type the property has visibility to the outside world.

    EventBufferList

    (from data)BufferConfiguration

    (from data)

    Engine

    (from policy)

    Car

    (from policy)11

  • 7/29/2019 UML for Designers

    12/3523 Jun 2004 Wipro Confidential 12

    Class Diagram/ Package Diagram

    UML notations can be extended to be used in different situations

    Symbols/

    Notation

    Description

    stereotypes Stereotypes are used extensively in the class diagrams to denote various type ofobjects such as DB tables, XML elements, EJB components etc.

    Interfaces These are consists of constants and method descriptions that a class or a set of classwould like to expose to the world.

    Class

    Interface

  • 7/29/2019 UML for Designers

    13/35

  • 7/29/2019 UML for Designers

    14/3523 Jun 2004 Wipro Confidential 14

    Class Diagram/ Package Diagram

    Package

    Presentation Layer

    Application Layer

    Domain Layer

    link

  • 7/29/2019 UML for Designers

    15/3523 Jun 2004 Wipro Confidential 15

    Object diagram

    Models the static behavior of the systemUsed for modeling pilot projects or validating the modelsSymbols/ Notation Description

    object This is an instance of the class. Graphically it is represented the same way asthe class with instancename:classname.

    Object attribute This is used to represent the attributes at the object instance level.

    Object operation This is used to represent the operations at the object instance level.

    Others The notations used for drawing class diagram is used in the object diagram aswell.

  • 7/29/2019 UML for Designers

    16/3523 Jun 2004 Wipro Confidential 16

    Use case diagram

    Used for representing functional model of the system

    Symbols/

    Notation

    Description

    System scope This is represented by a rectangular hollow box. This is used to define the boundary of the

    system.

    Use case This is represented by an ellipse shape. This is used to represent a set of transactions that

    provides some tangible value to the actors.

    actor An actor is represented by a stick man. An actor interacts with the use case to get some

    tangible value from the system.

    Links Actors are linked with the use cases when either they contribute to the use case or get

    some benefits from the use case. Use cases are linked with other use cases via includes

    and extends relationship.

    Includes If some functionality is common to multiple use cases then it can be separated as a use

    case and denoted by stereotype.

    Extends If there are two use cases in which one use case has a special type is functionality

    extending the other use case then it is represented by using extension point and denoted

    by stereotype.

    Packages Packages are used to group the use cases. Package is represented as

    Maintain System

    end user

    Insurance

  • 7/29/2019 UML for Designers

    17/3523 Jun 2004 Wipro Confidential 17

    Use case diagram

    Customer Read Purchase Policy Salesman

    Analyze Sales S tatisti cs

    Can be any type of

    customer

    Insurance system

    Insurance system

    System scope

    Package

    Use case

    ActorActor

    Notes

    Association

  • 7/29/2019 UML for Designers

    18/3523 Jun 2004 Wipro Confidential 18

    Use case diagram

    Insurance system

    Stereotypes

    Salesman

    Create Sales Data

    Update Sales Data

    Browse Holiday Special Catalog

    Browse Catalog

  • 7/29/2019 UML for Designers

    19/35

    23 Jun 2004 Wipro Confidential 19

    Sequence diagram

    Used for dynamic modeling of the system

    Symbols/ Notation Description

    Class roles The class role is a view of the class that helps achieve a particularfunctionality.

    Actor The notation and use of actor is same as that described in the usecase diagram. The actors start a sequence by acting upon thesystem.

    Represented the same way as the actors of the use case diagram.

    Message A message is ideally a method call between two classes.

    Lifeline Lifeline denotes the life span of a method call. Unless the methodimplementation is asynchronous, all the calls block till the childcalls return. This diagram helps to see if any object is blockedunnecessarily during a call which can be avoided.

    Loops These are self calls; when a object makes a call to itself to get someinformation.

  • 7/29/2019 UML for Designers

    20/35

    23 Jun 2004 Wipro Confidential 20

    Sequence diagram

    Lifeline

    Class roleMessage

    Loop

    : OrderEntryClerkOrderEntryWindow Order OrderLine Item

    start()prepare() prepare() checkLevel()

    isReorderLevel()

    reOrder()

    if reorder level is

    reached

  • 7/29/2019 UML for Designers

    21/35

    23 Jun 2004 Wipro Confidential 21

    Collaboration Diagram

    Used for dynamic modeling of the system

    Symbols/ Notation Description

    Objects The collaboration diagram uses an instance of a class and denotes itsbehavior.

    Links The links demonstrate the method calls between the classes.

    Message numbering The messages flowing between the classes are numbered so as to

    demonstrate how the messages are sequenced.

  • 7/29/2019 UML for Designers

    22/35

    23 Jun 2004 Wipro Confidential 22

    Collaboration Diagram

    : OrderEntryClerk

    OrderEntryWindow Oder

    OrderLine

    item

    1: start2: prepare()

    3: prepare()

    4: checkLevel()

    5: IsReorderLevel()

    6: reOrder()

    Object

    Message

    numbering

  • 7/29/2019 UML for Designers

    23/35

    23 Jun 2004 Wipro Confidential 23

    State machine Diagram

    Also called statechart diagram. Used for dynamic modeling.

    This is used to demonstrate the transitions for the state machine such as invoices,

    Purchase orders

    Symbols/ Notation Description

    State State is represented by rounded edged rectangle. This is used to demonstrate thestates at which the state machine waits for events to take place to move to adifferent or same state.

    A state may be a combination of states.

    Event transition Represented by a line with arrow. An event that triggers a state machine to movefrom one state to the other.

    Initial state Represented by a solid filled circle. Used for displaying the starting point of astate machine.

    Final state Represented by a circle surrounding a solid filled circle. This marks the end of thestate transition of the state machine. Here either the transaction is committed or

    rolled back.

    Self Transition that keeps the state machine where it was before the event transition.

    Created

    Created

    Created

  • 7/29/2019 UML for Designers

    24/35

    23 Jun 2004 Wipro Confidential 24

    State machine Diagram

    Invoice Created

    Unpaid PaidPaidTransaction Committed

    Start State

    End State

    State transition

    States

  • 7/29/2019 UML for Designers

    25/35

    23 Jun 2004 Wipro Confidential 25

    Activity Diagram

    Used for modeling business requirementsSymbols/

    Notation

    Description

    Activity This is represented by a rectangle whose vertical sides are represented as semi-circles.

    This is used to represent activity as the name suggests.

    Action flow Represented by lines with arrowheads. These are used to show how the actionschange the system behavior.

    Initial state Notation and usage are same as that of the Statechart diagram.

    End state Notation and usage are same as that of the Statechart diagram.

    Swim lanes Swim lanes are represented by vertical bars with titles that divide the activitydiagrams into various sections. These are used to denote the processes used byvarious groups in an organization

    Synchronization This is represented by a horizontal or vertical bar. This is used to denote concurrentactivities.

    Decision Represented by a diamond and denotes a decision point.

    States Notation and usage are same as that of the Statechart diagram. Denoted the sameway as the states in the state chart diagram.

    Receive order

    Procurement div

  • 7/29/2019 UML for Designers

    26/35

    23 Jun 2004 Wipro Confidential 26

    Activity Diagram

    Receive Order

    Start

    Fill Orders Send Invoice

    Overnight

    Delivery

    Regular Delivery

    Close orders

    Receive

    Payment

    Send Invoice

    End

    Fork

    Join

    Branch

    Join

    Activity

  • 7/29/2019 UML for Designers

    27/35

    23 Jun 2004 Wipro Confidential 27

    Component Diagram

    Used for representing the implementation view of the system. Represents software

    view of the system

    Symbols/ Notation Description

    Component Components are represented by the symbols described as

    It is used to denote independent piece of executable or code that can be used toachieve some functionality.

    Dependency This is denoted by a dotted line with arrowhead. The dependency can have a

    name associated with it. This is used to denote type of dependency between twocomponents.

    C1

  • 7/29/2019 UML for Designers

    28/35

    23 Jun 2004 Wipro Confidential 28

    Component Diagram

    Logging

    component

    Violation CorrelatorComponent

    Monitoring

    Component

    Uses

    Uses

    Dependency

    Component

  • 7/29/2019 UML for Designers

    29/35

    23 Jun 2004 Wipro Confidential 29

    Deployment Diagram

    Used for deployment view of the system. Represents hardware as well as software

    view of the system. This view is used by the system administrators and maintenance

    persons

    Symbols/ Notation Description

    Node This is denoted by a three dimensional box.

    This denotes a physical hardware. The location and software installed

    on this can be denoted to make it more meaningful for the system

    administrators and maintenance people.

    Communication This is denoted by a text between >. This is used to denote

    the type of communication between the nodes.

  • 7/29/2019 UML for Designers

    30/35

    23 Jun 2004 Wipro Confidential 30

    Deployment Diagram

    Client PC

    Web Server ApplicationServer

    Client PC

    DatabaseServer

  • 7/29/2019 UML for Designers

    31/35

    23 Jun 2004 Wipro Confidential 31

    UMLDos and Donts

    Dos:

    Create models for the complex components in the beginning and attack the other

    components later.

    Keep the model modular to make them simple and clear; complex models are noteffective.

    Check the accuracy of the model by using the tool or by expert review.

    Maintain the model consistency and integrity- different views of the same model should

    not tell a different story.

    Iterate through the model so that it evolves over a period of time to provide the right

    level of contents

    Keep the model updated- can reverse engineer the code to update the model at the

    end of the project.

    Donts:

    Dont mix UML with the project methodology; UML is generic enough to fit to any

    methodology.

    Dont try to create all the UML diagrams because they are defined; choose the onesthat are best fit for the solution to be designed.

    Choose the right model depending on the audience; use case and activity diagrams

    are perfect for the business users whereas class diagram, collaboration diagram and

    sequence diagrams etc. are more useful for the designers.

  • 7/29/2019 UML for Designers

    32/35

    23 Jun 2004 Wipro Confidential 32

    UML Tools

    Some of the advanced tools available in the market are:

    Rose (from IBM-Rational)

    Together Control Center (From Borland)

    Select Enterprise (From Aonix)

    Magic Draw (Magicdraw)

    OptimalJ (Compuware)

    Microsoft Visio (Microsoft)

    Some of the major features supported by the tools vendor that makes the tool lucrative for

    usage are

    Repository based modeling

    Capability for code generation

    Multi-user support

    Reverse engineering (generating design model from the existing code)

    Interchange of tools (via data exchange through XMI xml metadata interchange)

    Integration with other tools (such as requirement management and testing tools)

  • 7/29/2019 UML for Designers

    33/35

    23 Jun 2004 Wipro Confidential 33

    Whats Next

    To start using UML in a project you may do the following:

    Learn and practice UML

    Choose a tool

    Decide what diagrams are best suited for the project

    Decide whether to use a platform specific model (PSM) or platform independent model

    (PIM)

    Stat using it and get the models reviewed by the experts

    Some of the link that would help towards learning UML model is to

    http://www.omg.org/gettingstarted/what_is_uml.htm

    For definition of terms

    http://www.softdocwiz.com/UML.htm

    http://www.omg.org/gettingstarted/what_is_uml.htmhttp://www.softdocwiz.com/UML.htmhttp://www.softdocwiz.com/UML.htmhttp://www.omg.org/gettingstarted/what_is_uml.htm
  • 7/29/2019 UML for Designers

    34/35

    23 Jun 2004 Wipro Confidential 34

    References

    UML distilled

    by Martin Fowler & Kendall Scott

    UML 2 toolkit

    by Hans-Erik Eriksson, Magnus Penkar, Brian Lyon, David Fado

    Tool: Rational rose for illustrations

    http://www.omg.org/gettingstarted/what_is_uml.htm#12DiagramTypes

  • 7/29/2019 UML for Designers

    35/35

    Thank You

    Our promise

    With utmost respect to Human Values, we

    promise to serve our customers with Integrity,

    through Innovative, Value for Money solutions,

    by Applying Thought, day after day