170 likes | 303 Views
Procedural Activity. Patrick Bailey Keith Vander Linden Calvin College. Procedural Activity. Systems display procedural activity: Business work-flow Data flow Task behavior Concurrent processes Potential modeling solutions: Flow charts State diagrams Activity diagrams.
E N D
Procedural Activity Patrick Bailey Keith Vander Linden Calvin College
Procedural Activity • Systems display procedural activity: • Business work-flow • Data flow • Task behavior • Concurrent processes • Potential modeling solutions: • Flow charts • State diagrams • Activity diagrams
Activity Diagrams • Activity diagrams model activities as: • Actions • Transitions With additional features for decisions, forks, joins, etc. • They use many of the same elements provided for state diagrams. Example adapted from Fowler, 2004
Outline • History • Activity Diagrams • Examples • Using Activity Diagrams
Carl Adam Petri (1926- )Petri-Nets • 1962 • Extended state machines with token flow to represent concurrency • UML 2.0 activity diagrams use token flow and a similar structure. Petri Net for 4 dining philosophers. Images from www.informatik.uni-hamburg.de, August, 2005
Actions • Actions represent an encapsulated unit of activity. • They must have at least one incoming and one outgoing transition. • Actions can be implemented as: • Class methods • Code fragments • Sub-activities
Action Decomposition • Actions can be decomposed.
Signals • Actions can respond to and produce external signals: • Time signals • Other signals
Transitions • Transitions (aka. flows, edges) are like state diagram transitions except that they are not event-driven by default. • Behavior: • They transition in when all incoming transitions join. • They transition out when their action is complete. • Use connecters as a shorthand.
Data Flow • Transitions can carry parameter objects. • You can use pins to specify them.
Connectors • Connectors come in various forms: • Decision connectors • Junction connectors Example adapted from Fowler, 2004
Synchronization Bars • Concurrency is modeled with token flow in activity diagrams. • Tokens are: • Created at initial nodes • Passed from action to action during activities • Spawned at fork nodes • Joined a join nodes • Consumed at final nodes • The token flow must be “balanced”. Example adapted from Fowler, 2004
Termination States • Termination states represent either local or global termination, depending upon context. • Activity Final • Flow Final
Partitions • Activity diagrams don’t naturally specify agency. • Use partitions (aka. swim lanes) to do this. Example adapted from Fowler, 2004
Example: Parallel Algorithm Example from Douglass, Real Time UML, 2004
Using Activity Diagrams • Activity diagrams can represent: • Concurrency • Inter-object procedural sequences • They can be used to specify process for: • State activities (entry, exit, transition, do) • Use cases • Classes • Real-time modeling uses them primarily for concurrent algorithm specification.