how to draw uml diagrams

Upload: pratik-patel

Post on 07-Apr-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 How to Draw Uml Diagrams

    1/13

    How to Draw UML Diagrams

    What is UML?UML stands for Unified Modeling Language. This object-oriented system of notation has evolved from the work ofGrady Booch, James Rumbaugh,Ivar Jacobson, and the Rational Software Corporation. These renownedcomputer scientists fused their respective technologies into a single, standardized model. Today, UML is acceptedby the Object Management Group (OMG) as the standard for modeling object oriented programs.

    Types of UML DiagramsUML defines nine types of diagrams: class (package), object, use case, sequence, collaboration, statechart,activity, component, and deployment.

    Class DiagramsClass diagrams are the backbone of almost every objectoriented method, including UML. They describe the staticstructure of a system.

    EMBED Word.Picture.8 Package Diagrams

    Package diagrams are a subset of class diagrams, butdevelopers sometimes treat them as a separate technique.Package diagrams organize elements of a system intorelated groups to minimize dependencies between packages.

    Object DiagramsObject diagrams describe the static structure of a system ata particular time. They can be used to test class diagrams foraccuracy.

    Use Case Diagrams

    Use case diagrams model the functionality of system using

    actors and use cases.

    http://www.smartdraw.com/resources/centers/software/booch.htmhttp://www.smartdraw.com/resources/centers/software/omt.htmhttp://www.smartdraw.com/resources/centers/software/oose.htmhttp://www.rational.com/http://www.omg.org/http://www.smartdraw.com/resources/centers/uml/uml2.htm#whatclasshttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatpackhttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatpackhttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatobjhttp://www.smartdraw.com/resources/centers/uml/uml4.htm#whatusehttp://www.smartdraw.com/resources/centers/uml/uml4.htm#whatusehttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatobjhttp://www.smartdraw.com/resources/centers/uml/uml2.htm#whatclasshttp://www.smartdraw.com/resources/centers/software/booch.htmhttp://www.smartdraw.com/resources/centers/software/omt.htmhttp://www.smartdraw.com/resources/centers/software/oose.htmhttp://www.rational.com/http://www.omg.org/http://www.smartdraw.com/resources/centers/uml/uml2.htm#whatclasshttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatpackhttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatpackhttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatpackhttp://www.smartdraw.com/resources/centers/uml/uml3.htm#whatobjhttp://www.smartdraw.com/resources/centers/uml/uml4.htm#whatuse
  • 8/4/2019 How to Draw Uml Diagrams

    2/13

    Sequence DiagramsSequence diagrams describe interactions among classes interms of an exchange of messages over time.

    Collaboration DiagramsCollaboration diagrams represent interactions betweenobjects as a series of sequenced messages. Collaborationdiagrams describe both the static structure and the dynamicbehavior of a system.

    Statechart DiagramsStatechart diagrams describe the dynamic behavior of asystem in response to external stimuli. Statechart diagramsare especially useful in modeling reactive objects whose

    states are triggered by specific events.

    Activity DiagramsActivity diagrams illustrate the dynamic nature of a systemby modeling the flow of control from activity to activity. Anactivity represents an operation on some class in the systemthat results in a change in the state of the system. Typically,activity diagrams are used to model workflow or businessprocesses and internal operation.

    http://www.smartdraw.com/resources/centers/uml/uml4.htm#whatseqhttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatcollhttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatstatehttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatacthttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatacthttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatstatehttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatcollhttp://www.smartdraw.com/resources/centers/uml/uml4.htm#whatseqhttp://www.smartdraw.com/resources/centers/uml/uml4.htm#whatseqhttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatcollhttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatstatehttp://www.smartdraw.com/resources/centers/uml/uml5.htm#whatact
  • 8/4/2019 How to Draw Uml Diagrams

    3/13

    Component DiagramsComponent diagrams describe the organization of physicalsoftware components, including source code, run-time(binary) code, and executables.

    Deployment DiagramsDeployment diagrams depict the physical resources in asystem, including nodes, components, and connections.

    What is a UML Class Diagram?Class diagrams are the backbone of almost every object-oriented method including UML. They describe the staticstructure of a system.

    Basic Class Diagram Symbols and NotationsClasses represent an abstraction of entities with common characteristics. Associations represent the relationshipsbetween classes.

    ClassesIllustrate classes with rectangles divided into compartments.Place the name of the class in the first partition (centered,bolded, and capitalized), list the attributes in the second partition,

    and write operations into the third.Learn how to create this symbol.

    Active ClassActive classes initiate and control the flow of activity, whilepassive classes store data and serve other classes. Illustrateactive classes with a thicker border.

    VisibilityUse visibility markers to signify who can access the informationcontained within a class. Private visibility hides information fromanything outside the class partition. Public visibility allows all

    other classes to view the marked information. Protected visibilityallows child classes to access information they inherited from aparent class.Learn how to edit text.

    http://www.smartdraw.com/resources/centers/uml/uml6.htm#whatcomponenthttp://www.smartdraw.com/resources/centers/uml/uml6.htm#whatdeplhttp://www.smartdraw.com/resources/centers/uml/uml10.htm#tableshttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtexthttp://www.smartdraw.com/resources/centers/uml/uml6.htm#whatdeplhttp://www.smartdraw.com/resources/centers/uml/uml6.htm#whatcomponenthttp://www.smartdraw.com/resources/centers/uml/uml6.htm#whatcomponenthttp://www.smartdraw.com/resources/centers/uml/uml6.htm#whatdeplhttp://www.smartdraw.com/resources/centers/uml/uml10.htm#tableshttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtext
  • 8/4/2019 How to Draw Uml Diagrams

    4/13

    AssociationsAssociations represent static relationships between classes. Placeassociation names above, on, or below the association l ine. Use afilled arrow to indicate the direction of the relationship. Placeroles near the end of an association. Roles represent the way thetwo classes see each other.

    Note:It's uncommon to name both the association and the classroles.

    Learn how to connect two classes.

    Multiplicity (Cardinality)Place multiplicity notations near the ends of an association. Thesesymbols indicate the number of instances of one class linked toone instance of the other class. For example, one company willhave one or more employees, but each employee works for onecompany only.

    Complex Contraints

    Simple Constrain

    ConstraintPlace constraints inside curly braces {}.

    http://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#conn
  • 8/4/2019 How to Draw Uml Diagrams

    5/13

    Composition and AggregationComposition is a special type of aggregation that denotes astrong ownership between Class A, the whole, and Class B, itspart. Illustrate composition with a filled diamond.Use a hollow diamond to represent a simple aggregationrelationship, in which the "whole" class plays a more importantrole than the "part" class, but the two classes are not dependenton each other. The diamond end in both a composition and

    aggregation relationship points toward the "whole" class or theaggregate.

    GeneralizationGeneralization is another name for inheritance or an "is a"relationship. It refers to a relationship between two classes whereone class is a specialized version of another. For example, Hondais a type of car. So the class Honda would have a generalization

    relationship with the class car.

    In real life coding examples, the difference between inheritanceand aggregation can be confusing. If you have an aggregationrelationship, the aggregate (the whole) can access only thePUBLIC functions of the part class. On the other hand, inheritanceallows the inheriting class to access both the PUBLIC andPROTECTED functions of the superclass.

    What is a UML Package Diagram?Package diagrams organize the elements of a system into related groups to minimize dependencies among them

    Basic Package Diagram Symbols and Notations

    PackagesUse a tabbed folder to illustrate packages. Write the name of thepackage on the tab or inside the folder. Similar to classes, you can alsolist the attributes of a package.

    Learn how to resize a grouped object like a package.

    VisibilityVisibility markers signify who can access the information contained

    within a package. Private visibility means that the attribute or theoperation is not accessible to anything outside the package. Public

    visibility allows an attribute or an operation to be viewed by otherpackages. Protected visibility makes an attribute or operation visible topackages that inherit it only.

    Learn how to edit text on a symbol.

    http://www.smartdraw.com/resources/centers/uml/uml10.htm#grouphttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtexthttp://www.smartdraw.com/resources/centers/uml/uml10.htm#grouphttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtext
  • 8/4/2019 How to Draw Uml Diagrams

    6/13

    DependencyDependency defines a relationship in which changes to one package willaffect another package. Importing is a type of dependency that grantsone package access to the contents of another package.

    Learn how to draw dependencies and add arrows to your diagram.

    What is a UML Object Diagram?Object diagrams are also closely linked to class diagrams. Just as an object is an instance of a class, an objectdiagram could be viewed as an instance of a class diagram. Object diagrams describe the static structure of asystem at a particular time and they are used to test the accuracy of class diagrams.

    Basic Object Diagram Symbols and NotationsObject names

    Each object is represented as a rectangle, whichcontains the name of the object and its classunderlined and separated by a colon.Learn how to edit text on a symbol.

    Object attributesAs with classes, you can list object attributes in aseparate compartment. However, unlike classes, objectattributes must have values assigned to them.

    Active objectObjects that control action flow are called active

    objects. Illustrate these objects with a thicker border.

    MultiplicityYou can illustrate multiple objects as one symbol if theattributes of the individual objects are not important.

    http://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#addarrhttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtexthttp://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#addarrhttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtext
  • 8/4/2019 How to Draw Uml Diagrams

    7/13

    LinksLinks are instances of associations. You can draw a linkusing the lines used in class diagrams.

    Learn how to connect objects.

    Self-linkedObjects that fulfill more than one role can be self-linked. For example, if Mark, an administrativeassistant, also fulfilled the role of a marketing

    assistant, and the two positions are linked, Mark'sinstance of the two classes will be self-linked.

    What is a UML Use Case Diagram?Use case diagrams model the functionality of a system using actors and use cases. Use cases are services orfunctions provided by the system to its users.

    Basic Use Case Diagram Symbols and NotationsSystemDraw your system's boundries using a rectangle that contains usecases. Place actors outside the system's boundries.

    Use CaseDraw use cases using ovals. Label with ovals with verbs thatrepresent the system's functions.

    ActorsActors are the users of a system. When one system is the actor ofanother system, label the actor system with the actor stereotype.

    http://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#conn
  • 8/4/2019 How to Draw Uml Diagrams

    8/13

    RelationshipsIllustrate relationships between an actor and a use case with asimple line. For relationships among use cases, use arrowslabeled either "uses" or "extends." A "uses" relationship indicatesthat one use case is needed by another in order to perform atask. An "extends" relationship indicates alternative options undera certain use case.Learn how to draw relationships.

    What is a UML Sequence Diagram?Sequence diagrams describe interactions among classes in terms of an exchange of messages over time.

    Basic Sequence Diagram Symbols and Notations

    Class rolesClass roles describe the way an object will behave in context. Usethe UML object symbol to illustrate class roles, but don't listobject attributes.Learn how to edit text on a symbol.

    Activation

    Activation boxes represent the time an object needs to completea task.

    http://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtexthttp://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml10.htm#addtext
  • 8/4/2019 How to Draw Uml Diagrams

    9/13

    MessagesMessages are arrows that represent communication betweenobjects. Use half-arrowed lines to represent asynchronousmessages. Asynchronous messages are sent from an object thatwill not wait for a response from the receiver before continuing itstasks.Learn how to draw messages.

    Various message types for Sequence and Collaboration diagrams

    LifelinesLifelines are vertical dashed lines that indicate the object'spresence over time.Learn how to attach activation boxes to lifelines.

    Destroying Objects

    Objects can be terminated early using an arrow labeled"< < destroy > >" that points to an X.

    http://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#dropshaphttp://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#dropshap
  • 8/4/2019 How to Draw Uml Diagrams

    10/13

    Loops

    A repetition or loop within a sequence diagram is depicted as arectangle. Place the condition for exiting the loop at the bottomleft corner in square brackets [ ].Learn how to arrange objects on a page.

    What is a UML Collaboration Diagram?A collaboration diagram describes interactions among objects in terms of sequenced messages. Collaborationdiagrams represent a combination of information taken from class, sequence, and use case diagrams describingboth the static structure and dynamic behavior of a system.

    Basic Collaboration Diagram Symbols and NotationsClass rolesClass roles describe how objects behave. Use the UML objectsymbol to illustrate class roles, but don't list object attributes.

    Association rolesAssociation roles describe how an association will behave given a

    particular situation. You can draw association roles using simplelines labeled with stereotypes.Learn how to draw associations.

    MessagesUnlike sequence diagrams, collaboration diagrams do not have an

    explicit way to denote time and instead number messages inorder of execution. Sequence numbering can become nestedusing the Dewey decimal system. For example, nested messages

    under the first message are labeled 1.1, 1.2, 1.3, and so on. Thea condition for a message is usually placed in square bracketsimmediately following the sequence number. Use a * after thesequence number to indicate a loop.Learn how to add arrows to your lines.

    What is a UML Statechart Diagram?A statechart diagram shows the behavior of classes in response to external stimuli. This diagram models the thedynamic flow of control from state to state within a system.

    Basic Statechart Diagram Symbols and Notations

    StatesStates represent situations during the life of an object. You caneasily illustrate a state in SmartDraw by using a rectangle with

    rounded corners.

    http://www.smartdraw.com/resources/centers/uml/uml11.htm#sendbackhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#addarrhttp://www.smartdraw.com/resources/centers/uml/uml11.htm#sendbackhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#addarr
  • 8/4/2019 How to Draw Uml Diagrams

    11/13

    TransitionA solid arrow represents the path between different states ofan object. Label the transition with the event that triggered itand the action that results from it.Learn how to draw lines and arrows in SmartDraw.

    Initial StateA filled circle followed by an arrow represents the object'sinitial state.Learn how to rotate objects.

    Final StateAn arrow pointing to a filled circle nested inside another circlerepresents the object's final state.

    Synchronization and Splitting of Control

    A short heavy bar with two transitions entering it represents asynchronization of control. A short heavy bar with twotransitions leaving it represents a splitting of control thatcreates multiple states.

    What is a UML Activity Diagram?An activity diagram illustrates the dynamic nature of a system by modeling the flow of control from activity toactivity. An activity represents an operation on some class in the system that results in a change in the state ofthe system. Typically, activity diagrams are used to model workflow or business processes and internal operation.Because an activity diagram is a special kind of statechart diagram, it uses some of the same modelingconventions.

    Basic Activity Diagram Symbols and Notations

    Action statesAction states represent the noninterruptible actions of objects. Youcan draw an action state in SmartDraw using a rectangle with roundedcorners.

    Action FlowAction flow arrows illustrate the relationships among action states.Learn how to draw action flows.

    http://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml11.htm#rotateobjhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml11.htm#rotateobjhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#conn
  • 8/4/2019 How to Draw Uml Diagrams

    12/13

    Object FlowObject flow refers to the creation and modification of objects byactivities. An object flow arrow from an action to an object means thatthe action creates or influences the object. An object flow arrow froman object to an action indicates that the action state uses the object.Learn how to draw object flows.

    Initial StateA filled circle followed by an arrow represents the initial action state.

    Final StateAn arrow pointing to a filled circle nested inside another circlerepresents the final action state.

    BranchingA diamond represents a decision with alternate paths. The outgoingalternates should be labeled with a condition or guard expression. Youcan also label one of the paths "else."

    SynchronizationA synchronization bar helps illustrate parallel transitions.Synchronization is also called forking and joining.

    http://www.smartdraw.com/resources/centers/uml/uml8.htm#connhttp://www.smartdraw.com/resources/centers/uml/uml8.htm#conn
  • 8/4/2019 How to Draw Uml Diagrams

    13/13

    SwimlanesSwimlanes group related activities into one column.Read this this flowchart tutorial to learn how to create swimlanes inSmartDraw.

    http://www.smartdraw.com/resources/centers/flowcharts/tutorial2.htm#tablehttp://www.smartdraw.com/resources/centers/flowcharts/tutorial2.htm#tablehttp://www.smartdraw.com/resources/centers/flowcharts/tutorial2.htm#tablehttp://www.smartdraw.com/resources/centers/flowcharts/tutorial2.htm#table