State and Activity Diagrams in Uml

Only available on StudyMode
  • Topic: State diagram, Flowchart, Unified Modeling Language
  • Pages : 14 (2473 words )
  • Download(s) : 331
  • Published : November 13, 2010
Open Document
Text Preview
STATE AND ACTIVITY DIAGRAMS IN UML

Activity Diagrams

WHAT IS AN ACTIVITY DIAGRAM?
Activity diagrams consist of activities, states and transitions between activities and states. Activity diagrams combine ideas from event diagrams, Petri nets and state modeling techniques An activity diagram is a special case of state charts in which most or all states are activity states and most or all transitions are triggered by the completion of activities in the source state.

What is an Activity Diagram?
The diagram represents activities. It Looks like a “flowchart” or a “data flow” diagram. It is used to determine the processing logic of activities. – It shows the order of activities and shows concurrency and parallel behavior

An activity is a task which needs to be done. It can be a class method.

Activity Diagram - Purpose
Activity diagrams are a means of describing workflows and can be used in a variety of ways. Activity diagrams can be used throughout a project, from business analysis through to program design As an analysis tool – they can describe business flows in varying levels of detail – They can also be used to describe complex flows within or between use cases At the design level – They can be used to describe in detail the flow within an operation

Activity Diagram - Purpose
They are used to model business workflows They are used to identify candidate use cases, through the examination of business workflows. They are used to identify pre- and post-conditions for use cases. They are used to model workflow between use cases They are used to model workflow within use cases. They are used to model complicated workflows in operations on objects. They are used to model complex activities in a high level activity diagram in more detail

Example 1: Business workflow
Before we define the system use-cases, we may want to understand the business process where the use-cases fit.

Example 1: Business workflow

Fig. 10-2: Activity diagram to describe the business workflow of registration from the car sharer's perspective

Example 2: Workflow within an operation
We may want to describe a complex operation. The CarSharer object has an operation addRequirement()

Example 2: Workflow within an operation
The first attempt might look like this

Activities and Actions
Activities
– An activity is a unit of work that needs to be carried out

Actions within activities
– There are four ways in which an action can be triggered : • On Entry: these actions are triggered as soon as the activity starts. • Do: these actions take place during the lifetime of the activity. • On Event: these actions take place in response to an event. • On Exit: these actions take place just before the activity completes

An Activity Icon

Example: An activity with actions

Syntax of Actions
The action can be described in a simple English statement, or for more detailed design, using a programming language statement. An alternative form of action is the triggering of an event and this is written as : ^target. event (arguments) where – target is some object that needs to respond to the event, – event is the name of the event, and – arguments contain the information that is conveyed with the event.

Basic Symbols
bar
Synchronization

Decision Activity Start and End Trigger

Syntax of Transition
An action on a transition may trigger an event. The full syntax for the transition label is as follows – event(arguments) [condition] / action target. – sendEvent (arguments)

The order of execution of actions is as important

Triggerless Transitions
A transition is the movement from one activity to another, the change from one state to another, or the movement between a state and an activity in either direction A transition normally occurs when all the actions of an activity have been completed, or when an event triggers the exit from a particular state or activity

Notation: Triggerless Transitions...
tracking img