Top Banner
© Copyright IBM Corporation 2004 Trademarks Activity Diagrams: What They Are and How to Use Them Page 1 of 15 Activity Diagrams: What They Are and How to Use Them Maria Ericsson Principal Consultant IBM 22 April 2004 from The Rational Edge: Typically used for business process modeling, activity diagrams are also useful for system modeling. This article shows how to use them for both purposes within Rational Unified Process. In its basic form, an activity diagram is a simple and intuitive illustration of what happens in a workflow, what activities can be done in parallel, and whether there are alternative paths through the workflow. Activity diagrams as defined in the Unified Modeling Language 1 are derived from various techniques to visually illustrate workflows; see, for example, Johansson et al. 2 . And much of the basis for the definition of the activity diagram notation is found in Martin and Odell. 3 . In the Rational Unified Process 4 , we talk about how you can use activity diagrams to visualize the workflow of a business use case. A complete workflow description will have a basic flow, and one or several alternative flows. This workflow has a structure that we can define textually, using informal if, if-then-else, or do-until statements of various kinds. For a simple workflow with a simple structure, such textual definitions may be quite sufficient, but in the case of more complex structures, activity diagrams help to clarify and make more apparent what the workflow is. Historically, activity diagramming techniques have mostly been used in the business process modeling domain, but this article will also briefly discuss how you can use it in the system modeling domain.
15
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
  • Copyright IBM Corporation 2004 TrademarksActivity Diagrams: What They Are and How to Use Them Page 1 of 15

    Activity Diagrams: What They Are and How to UseThemMaria EricssonPrincipal ConsultantIBM

    22 April 2004

    from The Rational Edge: Typically used for business process modeling, activity diagrams arealso useful for system modeling. This article shows how to use them for both purposes withinRational Unified Process.

    In its basic form, an activity diagram is a simple and intuitive illustration of what happens in aworkflow, what activities can be done in parallel, and whether there are alternative paths throughthe workflow.

    Activity diagrams as defined in the Unified Modeling Language1 are derived from varioustechniques to visually illustrate workflows; see, for example, Johansson et al.2. And much of thebasis for the definition of the activity diagram notation is found in Martin and Odell.3.

    In the Rational Unified Process4, we talk about how you can use activity diagrams to visualizethe workflow of a business use case. A complete workflow description will have a basic flow,and one or several alternative flows. This workflow has a structure that we can define textually,using informal if, if-then-else, or do-until statements of various kinds. For a simple workflow with asimple structure, such textual definitions may be quite sufficient, but in the case of more complexstructures, activity diagrams help to clarify and make more apparent what the workflow is.

    Historically, activity diagramming techniques have mostly been used in the business processmodeling domain, but this article will also briefly discuss how you can use it in the systemmodeling domain.

    http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/

  • developerWorks ibm.com/developerWorks/

    Activity Diagrams: What They Are and How to Use Them Page 2 of 15

    The purpose of this article is to show how you can use activity diagrams within the Rational UnifiedProcess for business modeling as well as system modeling. Activity diagrams are often mentionedalmost as a synonym to business modeling. For a more complete introduction to what businessmodeling is we refer to Kruchten,5 and for details to Jacobson et al.6.

    The reader of this article is assumed to be familiar with the basics of the Unified ModelingLanguage (UML).

    Basic Activity Diagram NotationAs is common for most notations, the activity diagram notation has some elements that arenecessary for you to understand if you want to be "conversant" about activity diagrams. Thoseelements are presented in this section. The next section talks about additional goodies you mayfind useful. Figure 1 shows a basic activity diagram.

    Figure 1: An Activity Diagram for the Business Use Case Individual Check-Inin the Business Use-Case Model of Airport Check-in

    content/RationalEdge/jan02/t_activityDiagrams_fig1.gif

  • ibm.com/developerWorks/ developerWorks

    Activity Diagrams: What They Are and How to Use Them Page 3 of 15

    Click to enlarge

    Deploy with confidence

    Consistently deliver high-quality software faster using DevOps services on IBM Bluemix.Sign up for a free Bluemix cloud trial, and get started.

    Activity states, which represent the performance of a step within the workflow.

    Transitions that show what activity state follows after another. This type of transition can bereferred to as a completion transition. It differs from a transition in that it does not requirean explicit trigger event; it is triggered by the completion of the activity that the activity staterepresents.

    Decisions for which a set of guard conditions are defined. These guard conditions control whichtransition of a set of alternative transitions follows once the activity has been completed. Youmay also use the decision icon to show where the threads merge again. Decisions and guardconditions allow you to show alternative threads in the workflow of a business use case.

    Synchronization bars, which you can use to show parallel subflows. Synchronization bars allowyou to show concurrent threads in the workflow of a business use case.

    Advanced Notation

    In more complex examples, you would often make use of the following

    constructs:

    Conditional threads Nested activity diagrams Partitions

    Conditional Threads

    Guard conditions can be used to show that one of a set of concurrent threads is conditional. Forexample, in the individual check-in example from Figure 2, the passenger checking in might be afrequent flyer member. In that case, you need to award the passenger frequent flyer miles.

    content/RationalEdge/jan02/t_activityDiagrams_fig1.gifhttps://ace.ng.bluemix.net/#/solutions/solution=dev_opshttps://ace.ng.bluemix.nethttps://www.ng.bluemix.net/docs/#overview/overview.html

  • developerWorks ibm.com/developerWorks/

    Activity Diagrams: What They Are and How to Use Them Page 4 of 15

    Figure 2: Awarding Frequent Flyer Miles: a Conditional Thread in the IndividualCheck-In Workflow

    Click to enlarge

    Nested Activity Diagrams

    An activity state may reference another activity diagram, which shows the internal structure of theactivity state. Another way to say this is that you can have nested activity graphs. You can eithershow the sub-graph inside of the activity state (Figure 3), or let the activity state refer to anotherdiagram (Figure 4).

    content/RationalEdge/jan02/t_activityDiagrams_fig2.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig2.gif

  • ibm.com/developerWorks/ developerWorks

    Activity Diagrams: What They Are and How to Use Them Page 5 of 15

    Figure 3: A Nested Activity Graph Shown Within an Activity State

    Click to enlarge

    content/RationalEdge/jan02/t_activityDiagrams_fig3.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig3.gif

  • developerWorks ibm.com/developerWorks/

    Activity Diagrams: What They Are and How to Use Them Page 6 of 15

    Figure 4: Alternative: Put the Sub-Graph in a Separate Diagram and Let theActivity State Refer to It

    Click to enlarge

    Showing the sub-graph inside the activity state is convenient if you want to see all details of theworkflow in the same diagram. But if there is any level of complexity presented in the workflow, thiscan make the diagram hard to read.

    To simplify the workflow graph, you may instead choose to put the sub-graph in a separatediagram, and let the activity state sub-graph details refer to that diagram.

    Partitions

    The contents of an activity diagram may be organized into partitions (swimlanes) using solidvertical lines. A partition does not have a formal semantic interpretation, but is, in businessmodeling, often used to represent an organizational unit of some kind (Figure 5).

    content/RationalEdge/jan02/t_activityDiagrams_fig4.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig4.gif

  • ibm.com/developerWorks/ developerWorks

    Activity Diagrams: What They Are and How to Use Them Page 7 of 15

    Figure 5: An Activity Diagram Illustrating the Workflow of a Business UseCase that Represents a (Generic) Sales Process. In this example, the partitionsrepresent departments in the organization.

    Click to enlarge

    Documenting Business Use CasesBackground: A business use-case model describes the processes of a business and theirinteractions with external parties like customers and partners. The processes of the business arerepresented as business use cases, and the external parties are represented as business actors.Describing a business use case includes, among other things, giving it a name, a brief description,defining its performance goals, and its workflow. The most time-important and time-consumingaspect to describe is the workflow.

    Which comes first, the activity diagram or the textual description of the workflow? This issomewhat dependent on how you are used to working, and whether you "think graphically" or not.Some prefer to outline the structure visually in a diagram first, and then develop the details in thetext. Others start with a bulleted list of the activity states first, and agree on those (like a step-by-step outline to the use case), then define the structure using a diagram.

    A valid question is also whether you really need both the textual document and the diagram. Theactivity diagram technique allows you to write brief descriptions of each activity state, which should

    content/RationalEdge/jan02/t_activityDiagrams_fig5.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig5.gif

  • developerWorks ibm.com/developerWorks/

    Activity Diagrams: What They Are and How to Use Them Page 8 of 15

    make the textual specification of the workflow obsolete. Here, you need to be sensitive to youraudience and the format in which they expect the specification.

    To understand what an activity diagram adds to the understanding of a workflow, we presenta sample workflow description, and then an activity diagram for that workflow (Figure 6). Thisexample is a proposal process, taken from an organization that sells telecom network solutions,individually configured to each customer. We have simplified the example by removing the detailedtext in most of the subsections, but tried to keep enough so you can understand the structure ofthe workflow. The full text of this example can be found in The Rational Unified Process, version5.1.1.

    Figure 6: An Activity Diagram for the Business Use Case Proposal Process

    Click to enlarge

    Sample Basic Workflow for the Business Use Case Proposal Process (Figure 6)*

    1.1 Initial Contact

    content/RationalEdge/jan02/t_activityDiagrams_fig6.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig6.gif

  • ibm.com/developerWorks/ developerWorks

    Activity Diagrams: What They Are and How to Use Them Page 9 of 15

    This process starts with an initial contact between the customer and the company. This mayhappen in one of the following ways:

    1.2. Initial Opportunity Work

    1.2.1 Gather Preliminary Customer Requirements

    1.2.2 Create Sales Plan (optional)

    1.2.3 Perform Opportunity Analysis

    1.3. Create Proposal Project Plan

    1.4. Create Delivery Project Plan

    1.5. Prepare a Quote

    1.6. Compile Additional Information

    1.7. Analyze and Finalize the Proposal

    1.8. Present the Proposal

    1.9. Obtain Customer Decision

    Alternative Workflows

    2.1 Business Opportunity Rejected

    If, in 1.2., it turns out the business opportunity is rejected, the following actions may be taken:

    2.2 Unable to Meet Customer Requirements

    If, in Perform Opportunity Analysis or Prepare a Quote, the company is unable to suggest asolution to the customer requirements, then the following actions may happen:

    2.3 Critical Information Not Known

    If at any point in the Proposal Process the company identifies some critical information not knownor available then it does one of the following:

    2.4. New/Incomplete or Incorrect General Customer Profile

    If the company determines that the general customer profile is inaccurate for some reason, thefollowing actions may be taken.

    *(See the Rational Unified Process, v.5.1.1, for more detail.)

  • developerWorks ibm.com/developerWorks/

    Activity Diagrams: What They Are and How to Use Them Page 10 of 15

    An activity diagram for the workflow is shown in Figure 6. We use basic notation only in thisdiagram. Activity states correspond to sections in the workflow description:

    The activity state "Initial opportunity work" consists of three sub-steps that can be done in parallel.This is illustrated in a sub-graph to this activity state. See Figure 7.

    Figure 7: Sub-Diagram to the Activity State 'Initial Opportunity Work.' Creatinga sales plan is optional, which is indicated by a guard condition on theincoming transition.

    Click to enlarge

    An activity state can represent a fairly large procedure (with substructure), as well as somethingrelatively small. If you are using activity diagrams to define the structure of a workflow, you shouldnot attempt to explore several levels of activity graphs down to their most "atomic" level. This willmost probably make the diagram (or set of diagrams, if you are using separate sub-graphs) veryhard to interpret. You should aim at having one diagram that outlines the whole workflow, where afew of the activity states have sub-graphs.

    Documenting Business Use-Case RealizationsBackground: A business use-case realization describes how a particular business use case isrealized within the business object model, in terms of collaborating business workers and businessentities. A business worker represents a set of responsibilities typically carried by one individual.A business entity represents a "thing" that is created, managed, or used. The realization of abusiness use case can be described textually, but is more commonly explained with diagrams --collaboration diagrams, sequence diagrams, activity diagrams, or a combination. Which diagramtype you choose depends on the complexity of the workflow and where you are in the process.

    content/RationalEdge/jan02/t_activityDiagrams_fig7.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig7.gif

  • ibm.com/developerWorks/ developerWorks

    Activity Diagrams: What They Are and How to Use Them Page 11 of 15

    You are using the activity diagram to document business use-case realizations, rather thanbusiness use cases, if you are using partitions and the partitions are coupled to classes (businessworkers mainly) in the business object model (Figure 8).

    Compared to a sequence diagram, which could be perceived to have a similar purpose, anactivity diagram with partitions focuses on how you divide responsibilities onto classes, while thesequence diagram helps you understand how objects interact and in what sequence. Activitydiagrams give focus to the workflow, while sequence diagrams give focus to the handling ofbusiness entities. Activity diagrams and sequence diagrams could be used as complementarytechniques, where a sequence diagram shows what happens in an activity state.

    Figure 8: The Same Workflow Presented in Figure 6, But with ActivitiesOrganized in Partitions

    Click to enlarge

    Just for Business Modeling?

    Background: The use-case model is a model of a system's intended behaviors. A use case tellsthe story of how a user (represented as an actor in the model) can use the system to achievea particular purpose. Describing a use case includes giving it a name, a brief description, anddefining the flow of events of the use case.

    Just as you would use an activity diagram to show the structure of a workflow, you could also use itto show the structure of a flow of events of a system use case (Figure 9).

    content/RationalEdge/jan02/t_activityDiagrams_fig8.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig8.gif

  • developerWorks ibm.com/developerWorks/

    Activity Diagrams: What They Are and How to Use Them Page 12 of 15

    Figure 9: A Simplified Activity Diagram for the Use Case "Withdraw Money" inthe Use-Case Model of an Automated Teller Machine (ATM)

    Click to enlarge

    In the first stages of identifying objects and classes based on the use cases (use-case analysis),activity diagrams can be useful when exploring responsibilities of analysis classes. You might usethe activity diagram technique to draw a first sketch of class responsibilities, a sketch that you thenthrow away.

    Summary

    This article has given you an overview of:

    Basic and advanced elements of the activity diagram notation. Basic elements of activitydiagrams are activity states, transitions, decisions, and synchronization bars.

    content/RationalEdge/jan02/t_activityDiagrams_fig9.gifcontent/RationalEdge/jan02/t_activityDiagrams_fig9.gif

  • ibm.com/developerWorks/ developerWorks

    Activity Diagrams: What They Are and How to Use Them Page 13 of 15

    How activity diagrams allow you to show concurrent threads, and alternative threads, as wellas conditional threads in a workflow.

    How you can use activity diagrams in business modeling. You can illustrate the workflow ofa business use case. You can describe how a business use case is realized by businessworkers and business entities.

    How you can use activity diagrams in system modeling. You can illustrate the flow of events ofa use case. You can define how a use case is realized by analysis classes.

    References

    1. OMG UML Specification.

    2. H. Johansson, P. McHugh, J. Pendlebury, and W. Wheeler, III, Business ProcessReengineering. Breakpoint Strategies for Market Dominance. John Wiley and Sons, 1993.

    3. J. Martin and J. Odell, Object Oriented Methods: a Foundation, the UML Edition. Prentice Hall,1996.

    4. Rational Unified Process, version 5.1.1

    5. Philippe Kruchten, The Rational Unified Process: An Introduction. Addison-Wesley, 1998.

    6. Ivar Jacobson, Maria Ericsson, and Agneta Jacobson, The Object Advantage: BusinessProcess Reengineering with Object Technology. Addison-Wesley, 1994.

    *NOTE: This article was originally published on Rational Developer Network, the learning andsupport channel for the Rational customer community. Rational Developer Network is nowavailable to all Rational customers. If you are a customer and have not already registered for yourfree membership, please go to www.rational.net.

    http://www.ibm.com/software/rational/uml/http://www.rational.net

  • developerWorks ibm.com/developerWorks/

    Activity Diagrams: What They Are and How to Use Them Page 14 of 15

    Resources

    Learn

    Explore the Rational software area on developerWorks for technical resources, bestpractices, and information about Rational collaborative and integrated solutions for softwareand systems delivery.

    Stay current with developerWorks technical events and webcasts focused on a variety of IBMproducts and IT industry topics.

    Attend a free developerWorks Live! briefing to get up-to-speed quickly on IBM products andtools, as well as IT industry trends.

    Watch developerWorks on-demand demos, ranging from product installation and setupdemos for beginners to advanced functionality for experienced developers.

    Get products and technologies

    Try building and deploying your next project on the IBM Bluemix cloud platform, whereyou can take advantage of pre-built services, runtimes, frameworks, application lifecyclemanagement, and continuous integration.

    Download a free trial version of Rational software. Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use

    it in a cloud environment.

    Discuss

    Check the Rational software forums to ask questions and participate in discussions. Ask and answer questions and increase your expertise when you get involved in the Rational

    forums, cafs, and wikis. Join the Rational community to share your Rational software expertise and get connected

    with your peers.

    http://www.ibm.com/developerworks/rationalhttp://www.ibm.com/developerworks/offers/techbriefings/events.htmlhttp://www.ibm.com/developerworks/offers/techbriefings/http://www.ibm.com/developerworks/offers/lp/demos/http://ace.ng.bluemix/net/http://www.ibm.com/developerworks/rational/downloads/http://www.ibm.com/developerworks/downloads/https://www.ibm.com/developerworks/community/forums/html/category?id=33333333-0000-0000-0000-000000000024http://www.ibm.com/developerworks/forums/dw_rforums.jspahttp://www.ibm.com/developerworks/forums/dw_rforums.jspahttp://www.ibm.com/developerworks/rational/community/cafehttps://www.ibm.com/developerworks/mydeveloperworks/wikis/home?lang=en_US#/wiki/Rational%20Wiki%20Central/page/Rational%20Wikihttp://ibm.co/rationalcommunity

  • ibm.com/developerWorks/ developerWorks

    Activity Diagrams: What They Are and How to Use Them Page 15 of 15

    About the author

    Maria Ericsson

    Maria Ericsson is a principal consultant for IBM Rational's Strategic ServicesOrganization (SSO). She started working in the field of software engineering andobject technology in 1990 at Objectory AB, and co-authored Ivar Jacobson's book,The Object Advantage: Business Process Re-engineering with Object Technology.Since joining Rational in 1995, she has worked as a mentor and trainer in process,business modeling, and requirements management, and also spent three years asa member of the Rational Unified Process, or RUP, development team. As partof the SSO, she currently focuses on solution deployment strategies and serves onthe IBM Rational field training team. A resident of Sweden, she is based in the Kistaoffice.

    Copyright IBM Corporation 2004(www.ibm.com/legal/copytrade.shtml)Trademarks(www.ibm.com/developerworks/ibm/trademarks/)

    http://www.ibm.com/legal/copytrade.shtmlhttp://www.ibm.com/developerworks/ibm/trademarks/

    Table of ContentsBasic Activity Diagram NotationFigure 1: An Activity Diagram for the Business Use Case Individual Check-In in the Business Use-Case Model of Airport Check-in

    Advanced NotationConditional ThreadsFigure 2: Awarding Frequent Flyer Miles: a Conditional Thread in the Individual Check-In Workflow

    Nested Activity DiagramsFigure 3: A Nested Activity Graph Shown Within an Activity StateFigure 4: Alternative: Put the Sub-Graph in a Separate Diagram and Let the Activity State Refer to It

    PartitionsFigure 5: An Activity Diagram Illustrating the Workflow of a Business Use Case that Represents a (Generic) Sales Process. In this example, the partitions represent departments in the organization.

    Documenting Business Use CasesFigure 6: An Activity Diagram for the Business Use Case Proposal ProcessFigure 7: Sub-Diagram to the Activity State 'Initial Opportunity Work.' Creating a sales plan is optional, which is indicated by a guard condition on the incoming transition.

    Documenting Business Use-Case RealizationsFigure 8: The Same Workflow Presented in Figure 6, But with Activities Organized in Partitions

    Just for Business Modeling?Figure 9: A Simplified Activity Diagram for the Use Case "Withdraw Money" in the Use-Case Model of an Automated Teller Machine (ATM)

    SummaryReferencesResourcesAbout the authorTrademarks