ObjectOriented Software Engineering An Agile Unified Methodology by
Object-Oriented Software Engineering: An Agile Unified Methodology by David Kung Chapter 14. Activity Modeling for Transformational Systems Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Key Takeaway Points • Activity modeling deals with the modeling of the information processing activities of an application or a system that exhibits sequencing, branching, concurrency, as well as synchronous and asynchronous behavior. • Activity modeling is useful for the modeling and design of transformational systems. 14 -2 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Activity Modeling in the Methodology Context Use case-iteration allocation matrix Business goals & needs Current situation Accommodating Requirements Change Acquiring Requirements Customer feedback Iteration use cases Domain Modeling Preliminary requirements Domain model Deriving Use Cases from Requirements Domain model Actor-System Interaction Modeling Abstract & high level use cases, use case diagrams Expanded use cases & UI design Behavior Modeling & Responsibility Assignment Allocating Use Cases & Subsystems to Iterations Behavior models Use case-iteration allocation matrix Deriving Design Class Diagram Producing an Architecture Design class diagram Software architecture (a) Planning Phase control flow Test Driven Development, Integration, & Deployment (b) Iterative Phase – activities during each iteration data flow control flow & data flow 14 -3 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
What Is Activity Modeling • Activity modeling focuses on modeling and design for – complex information processing activities and operations – information flows and object flows among the activities – branching according to decisions – synchronization, concurrency, forking, and joining control flows – workflow among the various departments or subsystems 14 -4 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Why Activity Modeling Systems analysis and design need to • describe current information processing activities in the organization or existing system (modeling of the existing system) to help the development team understand the existing business • describe information processing with the proposed solution (system design) 14 -5 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Activity Diagram • An activity diagram models the information processing activity in the real world (analysis model) or the system (design model). • A UML activity diagram is a combination of – flowchart diagram • for decision making or branching – data flow diagram • for information processing and data flows – Petri net diagram • for various control flows • for synchronization, concurrency, forking, and joining 14 -6 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
A Flowchart decision making x=x+1 x<10 y=y+1 y<10 14 -7 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
A Data Flow Diagram information processing activity Books Book details Publishers address Customer orders 1 Verify Order Credit status verified order 2 Generate Requisition to Publisher Pending orders Publisher Purchase orders Order details data flow Customers 14 -8 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Petri Nets places, representing an abstract condition transitions, representing an event or happing relationship between a place and a transition, it can only come from a place to a transition or from a transition to a place tokens, which can be placed in places to indicate that the condition is true 14 -9 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
A Petri Net Example a new job arrives processor available job waiting events job being processed You can interpret the places and transitions. That is, assigning meanings to them. begin process done job ready to go condition of system job leaves 14 -10 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Petri Net Execution t 1 t 2 t 3 t 4 • A transition is enabled if and only if each of its input places contains a token. • A transition can be fired sooner or later if it is enabled. • Firing a transition – removes a token from each of its input places AND – places a token into each of its output places 14 -11 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Petri Net Marking An initial marking is an assignment of tokens to places. t 1 p 2 p 1 t 2 t 1 is always enabled, because it does not have an input place. firing t 1 places a token in p 1 t 2 is now enabled p 3 t 3 firing t 2 removes one token from each of p 1 and p 2 and places one token in p 3 p 4 t 3 is now enabled t 4 firing t 3 removes one token from p 3 and places one token in p 4 and p 2 14 -12 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Petri Net Marking job waiting job being processed a new job arrives processor available “a new job arrives” is always enabled, meaning a new job can arrive anytime. fire “a new job arrives” “begin process” is now enabled begin process fire “begin process” job is being processed “process done” is now enabled process done job ready to go job leaves fire “process done” job is ready to leave & processor is available again “job leaves” is now enabled fire “job leaves” Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved. 14 -13
Analysis of Petri Net t 1 p 2 p 1 t 2 p 3 (p 1, p 2, p 3, p 4) (0, 1, 0, 0) t 1 (1, 1, 0, 0) t 2 t 1 (1, 1, 0, 0) (0, 0, 1, 0) t 3 p 4 t 4 14 -14 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Petri Net Analysis Tree t 1 p 4 t 4 • A marking is presented by a list of “ 0” and “ 1”: p 2 (n 1, n 2, . . . , nk) where ni = 1 if place i contains a t 2 token • The root of the tree denotes the p 3 initial marking (initial system state). t 3 • Thus, the initial marking and root of tree for the Petri net on left is: (0, 1, 0, 0). 14 -15 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Petri Net Analysis Tree t 1 p 2 p 1 t 2 p 3 t 3 p 4 • Firing a transition grows the tree with a new branch, labeled by the transition fired and the resulting new marking. (0, 1, 0, 0) t 1 (1, 1, 0, 0) t 1 t 2 (1, 1, 0, 0) (0, 0, 1, 0) t 1 p 2 p 1 t 4 t 1 t 2 p 3 t 3 p 4 t 4 p 2 p 1 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved. p 4 t 4 14 -16
Petri Net Analysis t 1 p 2 t 2 p 3 t 3 p 4 t 4 w denotes a large number of tokens because t 1 can be fired many times. (0, 1, 0, 0) t 1 (w, 1, 0, 0) t 2 (w, 0, 1, 0) t 3 (w, 1, 0, 1) t 2 t 4 (w, 1, 0, 0) (w, 0, 1, 0) These have occurred at a higher level. Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved. 14 -17
Petri Net Expressiveness parallelism sequencing synchronization exclusion 14 -18 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Activity Diagram Notions and Notations Activity or action Conditional branching Control flow Object flow obj: Class Forking Joining or synchronization Swim lane to represent info and control flow between departments/subsystems Initial node, final node, and flow final node Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved. 14 -19
Box Office Order Processing branching Set Up Order [single order] activity [subscription] Assign Seats branching condition Assign Seats forking to create concurrent threads Award Bonus Debit Account Charge Credit Card joining to synchronize concurrent threads Mail Package merging alternating threads 14 -20 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Activity Diagram: Swim Lane Customer Sales Accounting object flow Place Order Warehouse Pack Items : New. Order Ship Order branching Verify Order forking [reject] [ok] Show Msg Fill Order Send Invoice : Invoice Make Payment Process Payment merging alternating routes Close Order joining concurrent threads 14 -21 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Activity Decomposition and Invocation • A complex activity can be decomposed and represented by another activity diagram. • The rake-style symbol is used to signify that the activity has a more detailed activity diagram. <<Server>> An Activitiy Database Another DB It is described by a more detailed activity diagram. 14 -22 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Expansion Region • An expansion region is a subset of activities or actions that should be repeated for each element of a collection. • The repeated region may produce one or more collections. A collection of line items Place Order : Line. Item Add Item to shipment : Item Add Cost to Invoice : Line. Item. Cost : Shipment Ship Order : Invoice Send Invoice Expansion region 14 -23 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Using Activity Diagram • Modeling, analysis and design of complex information processing activities involving one or all of the following: – control flows – object flows or data flows – access to databases or data depositories – conditional branching – concurrent threads – synchronization • Work flow among multiple organizational units and/or subsystems. Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved. 14 -24
Using Activity Diagram • Activity diagram can be used alone or used with the other diagrams. • Activity diagram can be used to model the information processing activity of a system, subsystem or component, or a method of a class. 14 -25 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Steps for Activity Modeling 14 -26 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Relation to Other Diagrams • An activity may be a use case, or suggest a use case. Therefore, activity modeling is useful for identifying use cases. • Activity diagrams are useful for showing workflows and control flows among use cases. • Activity modeling is useful for processing complex requests in a sequence diagram. • An activity may exhibit state-dependent behavior, which can be refined by state modeling. 14 -27 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Relation to Other Diagrams • A state may represent a complex process, which can be modeled by an activity diagram. • Each object sent from one activity to another should appear in the design class diagram (DCD), or the domain model. • Swim lanes may suggest object classes in the domain model, or the DCD. The activities of the swim lane identify operations for the class. • A complex activity may decompose into lowerlevel activities. Some of these may be operations of the class. 14 -28 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Class Exercise • Describe the activities for doing one of the following: – preparing and submitting a project proposal in your organization – buying a new or used car – workflow for configuration management • Convert the description into an activity diagram. • Review the diagram and identify potential problems. 14 -29 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
Applying Agile Principles • Value working software over comprehensive documentation. • Active user involvement is imperative. • A collaborative and cooperative approach between all stakeholders is essential. • Capture requirements at a high level; make them lightweight and visual. • Do barely enough activity modeling. 14 -30 Copyright {c} 2014 by the Mc. Graw-Hill Companies, Inc. All rights Reserved.
- Slides: 30