Activity Diagrams Derived from several techniques: Event diagrams of Jim Odell SDL state modeling...

Post on 21-Dec-2015

218 views 2 download

Transcript of Activity Diagrams Derived from several techniques: Event diagrams of Jim Odell SDL state modeling...

Activity Diagrams

Derived from several techniques:Event diagrams of Jim OdellSDL state modeling techniquesWorkflow modelingPetri nets

Especially useful when:Modeling a workflowModeling an operationDescribing behavior that has a lot of parallel processing

Activity

Activity is the state of doing something

Real-world process like typing a letterExecution of a software routine like a method on a class.Rounded rectangle is narrower and more oval-shaped than the state icon.

Activity Diagrams vs. State Diagrams

Activity diagram describes the sequencing of activities, with support for both conditional and parallel behaviorActivity diagram is a variant of a state diagram in which most, if not all, the states are activity states.Much of the terminology used in Activity diagrams follows that of state diagrams.

Activity Diagram

Activity vs.State Diagrams

Activity vs. State Diagrams

Activity Diagram

Activity Diagrams

Activity diagrams: allow the user to choose the order in which to do things states the essential sequencing rules that must be followed

Flowcharts are limited to sequential processes, whereas activity diagrams can handle parallel processes

Forks & Joins

A join synchronizes parallel behaviorForks and joins must match – every time you have a fork, you must have a join that combines the threads started by that fork.

Forks & Joins

Extensions to previous rule: A thread that comes out of a fork can itself fork, with the new threads coming back together before reaching the matching join

Forks & Joins

Extensions to previous rule: If a thread coming out of a fork goes straight to another fork, you can remove the second fork and just have the threads from the second fork coming out of the first fork.

Decomposing an Activity

An activity can be broken down into subactivities using notation similar to superstates and substates on a state diagram.

Activity Diagram

Dynamic Concurrency

Swimlanes

Our activity diagrams so far have focused on what happens, but they do not tell you who does what.Communication among responsible objects is missing.Swimlanes can be used to arrange activity diagrams into “zones of responsibility.”

Activity Diagram

Assigning Objects to Activities

The task of assigning objects to activities should be done.Should it be done immediately when initially diagramming activities, or later when an overall sense of the behavior is understood?

Activity Diagrams

StrengthsSupport and encourage parallel behavior• Good tool for workflow modeling• Good tool for multithreading

WeaknessesLinks among actions and objects are not especially clear• Interaction diagrams are more helpful in

this area

When to use Activity Diagrams

Analyzing a Use CaseUnderstanding WorkflowDescribing a complicated sequential algorithmDealing with multithreaded applications

When not to use Activity Diagrams

Trying to see how objects collaborateTrying to see how an object behaves over its lifetimeRepresenting complex conditional logic

ObjectFlow

ESU Revisited

Preparing for RegistrationThe process of preparing the course curriculum and making it available to the student community can be expressed using an Activity Diagram.We don’t assign responsibilities to each activity at this time.

ESU Revisited

Create Curriculum

Select Courses to Teach

Create Catalog

ESU Revisited

Preparing for RegistrationWe must make sure all courses have been assigned a professor

ESU Revisited

Create Curriculum

Select Courses to Teach

Create Catalog

Assign Professor to Course

[Not all professors assigned]

[All professors assigned]

Use Case

Class DiagramActivity Diagram

ObjectDiagram

Sequence Diagram

CollaborationDiagram

StateDiagram

The UML and Design Flow