Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Procedural Activity Patrick Bailey Keith Vander Linden Calvin College
Smith’s Aerospace © P. Bailey & K. Vander Linden, Procedural Activity ● Systems display procedural activity: – Business work-flow – Data flow – Task behavior – Concurrent processes ● Potential modeling solutions: – Flow charts – State diagrams – Activity diagrams
Smith’s Aerospace © P. Bailey & K. Vander Linden, 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
Smith’s Aerospace © P. Bailey & K. Vander Linden, Outline ● History History ● Activity Diagrams Activity Diagrams ● Examples Examples ● Using Activity Diagrams Using Activity Diagrams
Smith’s Aerospace © P. Bailey & K. Vander Linden, ● 1962 ● Extended state machines with token flow to represent concurrency ● UML 2.0 activity diagrams use token flow and a similar structure. Carl Adam Petri (1926- ) Petri-Nets Images from August, 2005 Petri Net for 4 dining philosophers.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 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
Smith’s Aerospace © P. Bailey & K. Vander Linden, Action Decomposition Actions can be decomposed.
Smith’s Aerospace © P. Bailey & K. Vander Linden, Signals Actions can respond to and produce external signals: – Time signals – Other signals
Smith’s Aerospace © P. Bailey & K. Vander Linden, 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.
Smith’s Aerospace © P. Bailey & K. Vander Linden, Data Flow ● Transitions can carry parameter objects. ● You can use pins to specify them.
Smith’s Aerospace © P. Bailey & K. Vander Linden, Connectors Connectors come in various forms: – Decision connectors – Junction connectors Example adapted from Fowler, 2004
Smith’s Aerospace © P. Bailey & K. Vander Linden, 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
Smith’s Aerospace © P. Bailey & K. Vander Linden, Termination States Termination states represent either local or global termination, depending upon context. − Activity Final − Flow Final
Smith’s Aerospace © P. Bailey & K. Vander Linden, Partitions ● Activity diagrams don’t naturally specify agency. ● Use partitions (aka. swim lanes) to do this. Example adapted from Fowler, 2004
Smith’s Aerospace © P. Bailey & K. Vander Linden, Example: Parallel Algorithm Example from Douglass, Real Time UML, 2004
Smith’s Aerospace © P. Bailey & K. Vander Linden, Example: HCI
Smith’s Aerospace © P. Bailey & K. Vander Linden, 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.