1 / 15

Activity Diagram - Revisited

Activity Diagram - Revisited Activity Diagram Also called an “activity graph”, is a variation of a state machine representing actions and subactivities Remember the difference between “activity” and “action” in UML Activity : A sequence of actions that take finite time and can be interrupted

omer
Download Presentation

Activity Diagram - Revisited

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Activity Diagram - Revisited C-S 546

  2. Activity Diagram • Also called an “activity graph”, is a variation of a state machine representing actions and subactivities • Remember the difference between “activity” and “action” in UML • Activity : A sequence of actions that take finite time and can be interrupted • Action: An atomic task that cannot be interrupted (at least from user’s perspective) C-S 546

  3. Activity Diagram (continued) • Transitions in an activity diagram do not have labels • They indicate the completion of an action or subactivity and show the sequence of actions or subactivities • Consequently, these transitions are not based on external events • An activity diagram may describe a use case, an operation or a message • Purpose: to describe implementation-oriented details C-S 546

  4. Activity Diagram – Basic Syntax Action 1 Action 2 Action 3 Action 4 [C] [~C] split merge C-S 546

  5. Activity Diagram - semantics • Each action state must have a label; otherwise, no information is conveyed by that action state • A transition can be split (see the vertical bar) into multiple transitions that can reach multiple action states • These transitions occur concurrently; in the previous diagram, “Action 2” and “Action 3” said to occur concurrently, after “Action 1” C-S 546

  6. Activity Diagram – Semantics (continued) • Two or more transitions can be combined together using a merge (the same vertical bar notation) • The destination after the merge can be reached ONLY AFTER the source actions are completed • In the previous diagram, if “Action 4” is invoked, the entire activity terminates ONLY AFTER “Action 2” and “Action 4” complete C-S 546

  7. Activity Diagram – Semantics (continued) • An outgoing transition from an action state may end up in a condition box (a diamond symbol) and hence will be split into 2 or 3 transitions • The conditions must be MUTUALLY EXCLUSIVE • Action state labels may represent methods and hence may include parameters C-S 546

  8. [No coffee] [No cola] Find Beverage [found cola] [found coffee] Put Coffee in Filter Add Water Get Cups Get cola can(s) Put filter in M/c Switch on M/c Wait until brewed Drink Pour into cup Preparing Beverages - ©UML Manual version 1.5 C-S 546

  9. false amount > 0 report error true false balance  amount amount – balance  N false report error true true balance = balance - amount Use case “withdraw” with overdraft protection ‘N’ represents overdraft limit C-S 546

  10. Subactivity An action state in an activity diagram can be represented by a subactivity as shown below Subactivity A subactivity represents a simplification of another activity diagram It reduces the space for an activity diagram C-S 546

  11. Subactivity - semantics • A subactivity is a representation of another activity diagram • The incoming arrow to a subactivity matches with the initial state of the activity diagram represented by the subactivity • The outgoing arrow from a subactivity matches with the final state of the activity diagram represented by the subactivity C-S 546

  12. Swimlanes • Several activity diagrams can be merged into one diagram • particularly to show the interacting actions between these diagrams • Each activity diagram is enclosed in a separate box and the boxes are joined together in the swimlane diagram • See the example in the next slide C-S 546

  13. Customer Sales Stockroom Request service Take Order Pay Fill Order Deliver order Collect order C-S 546

  14. Objects as parameters • Objects passed as parameters between action states can be represented in the activity diagram (and in swimlane diagram) using the same syntax for objects • The transition between an object parameters and an action state is represented with a dashed line, instead of a solid line C-S 546

  15. Customer Sales Stockroom Request service : Order [placed] :Order [entered] Take Order Pay Fill Order : Order [filled] :Order [delivered] Deliver order Collect order C-S 546

More Related