Modeling UML ActivityDiagram Prof. U.VERMA C.E. Dept. MPSTME Shirpur Campus
[email protected] 1 Activity Diagrams • Activity diagrams are one of the five diagrams in the UML for modeling the dynamic aspects of systems. • Activity diagrams fall under the category of behavioral diagrams in Unified Modeling Language. • Visually represent the flow of control in a system. • It is more powerful than a simple flow chart since it can represent various other concepts like concurrent activities, their joining, and so on.
[email protected] 2 upendra.verma@nmims. Unlike a traditional flowchart. an activity diagram shows concurrency as well as branches of control.edu 3 . showing flow of control from activity to activity.Activity Diagrams cont’d • An activity diagram is essentially a flowchart. Components of an Activity Diagram • • • • • • • • Activity Flow Decision Merge Fork Join Note Partition upendra.edu 4 .verma@nmims. Activity • An activity denotes a particular action taken in the logical flow of control.edu 5 . • Behavior expressed as a set of actions connected by control and data flows.verma@nmims. upendra. • A label inside the rectangle identifies the corresponding activity. • There are two special type of activity nodes: initial and final. • An activity is represented with a rounded rectangle. • A final node represents the end point of all activities.
[email protected] cont’d • Initial node represents the starting point of a flow in an activity diagram.edu 6 . called the guard condition. • This is used to depict transfer of control from one activity to another . indicating the necessary condition for the transition to
[email protected] 7 . upendra. • A flow is often accompanied with a label. or transition) is represented with a directed arrow.Flow • A flow (also termed as edge. • The outgoing edges often have guard conditions indicating true-false or if-then-else conditions. • note can be attached to the decision node indicating the condition to be tested. is a point where a single flow enters and two or more flows leave. they can be omitted in obvious cases.
[email protected] 8 . represented with a diamond. However.Decision • A decision node. and a single flow leaving out.verma@nmims. • A merge node represents the point where at least a single control should reach before further processing could continue. with two or more flows entering.edu 9 .Merge • This is represented with a diamond shape. upendra. For example.Fork • Fork is a point where parallel activities begin. upendra. he can in parallel apply for student ID card and library card.edu 10 . • A fork is graphically depicted with a black bar.verma@nmims. when a student has been registered with a college. with a single flow entering and multiple flows leaving out. verma@nmims. but a single output flow. in case of a join all of the incoming controls must be completed before any further progress could be made.edu 11 . upendra. • It represents the synchronization of all concurrent activities. with multiple input flows. • Unlike a merge.Join • A join is depicted with a black bar. edu 12 . and the sales company has received it's payment.Join cont’d • For example. upendra. a sales order is closed only when the customer has receive the product.verma@nmims. edu 13 .Note • UML allows attaching a note to different components of a diagram to present some textual information.verma@nmims. upendra. • The information could simply be a comment or may be some constraint. upendra. • Partitions in an activity diagram are not mandatory. • The drawing area can be partitioned into multiple compartments using vertical (or horizontal) parallel lines.Partition • Different components of an activity diagram can be logically grouped into different areas. called partitions or swim lanes.edu 14 .verma@nmims. • At first a form is filled up with relevant and correct information.A Simple Example • Figure shows a simple activity diagram with two activities. it is then submitted. Once it is verified that there is no error in the
[email protected] 15 . upendra. • The figure depicts two stages of a form submission. edu 16
[email protected] Simple Example cont’d upendra. • Identify the next logical activity that should be performed.verma@nmims. • Put guard conditions on the edges to avoid confusion upendra.Guidelines for drawing an Activity Diagram • Identify tiny pieces of work being performed by the system.edu 17 . edu 18 .Case Study of LIS upendra.verma@nmims. edu 19
[email protected] Study of LIS cont’d From the given problem we can identify at least three different functionality offered by the system: • Register a new member • Issue book • Update inventory upendra. For users' who don't have an account already and have submitted their registration forms. If all information have been provided correctly. Otherwise. and submits to the librarian. which is to be provided for any future transaction in the library. Once a new account has been created for the user. librarian goes on with creating a new account for the user. he (she) is being issued an ID card.Activity diagram for user registration A new user fills up the registration form for library membership (either online or in paper). herself).edu 20 . upendra.verma@nmims. the user is asked to provide all and correct information in his (her) registration form. the librarian verifies the information provided. an already registered user can't create another account for himself (or. possibly against the central database used by the institution. Of course. edu 21
[email protected] diagram for user registration cont’d upendra. edu 22 .Activity diagram for issuing books upendra.verma@nmims. edu 23
[email protected] diagram for updating inventory upendra. Draw Activity Diagram for Admission Procedure at NMIMS University upendra.edu 24 .verma@nmims. Activity Diagram for Student Admission Procedure
[email protected] 25 . Exercise Draw Activity Diagram for Online Budgeting Control System. • Identify Activities • Transition from one activity to another activity • Identify Parallel Activities • Identify role for component • Identify the guard conditions
[email protected] 26 .