Wednesday 6 February 2013

Activity Diagram


  1. Activity diagrams are the object oriented equivalent of flow charts and data flow diagrams from structured development
  2. Activity diagrams describe the workflow behavior of a system
  3. The process flows in the system are captured in the activity diagram
  4. Activity diagram illustrates the dynamic nature of a system by modeling the flow of control from activity to activity
  • An activity diagram contains activity states. An activity state represents the execution of a statement in a procedure or the performance of an activity in a workflow
  • An activity state waits for the completion of its computation. When the activity completes then execution proceeds to the next activity state within the diagram
  • When to use Activity Diagrams?
    1.  a complex operation
    2.  a complex business rule
    3.  a single use case
    4.  several use cases
    5.  a business process
    6.  software processes
element of activity diagram




Transition

A transition is a relationship between two states that indicates when event occurs that the object will move to another state.

For example when the "off hook" event occurs, the phone goes from the idle state to the active state.

Event

An event is a significant or noteworthy occurrence

For example a phone is taken of the hook

The event which trigger a state change can be added to the transition lines on a state diagram. The action which actually moves the object into the new state can also be specified. There are referred to as trigger events and actions. If an event occurs without an explicit trigger, such as would occur if a state completes an activity then moves to the next state, it is referred to as a trigger-less transition


State


A state is the condition of an object at an instance of time.

For example a phone is in an idle state it is taken off the hook

A state representation can be divided into three sections

  • state name
    • this is supplied regardless of whether the state representation is subdivided or not
  • state variable
    • three commonly used state variable are entry, exit and do. A good example of an object that has state variables is a fax machine
  • activities
    • these represent action that can be carried out during the state

State Transition Diagram

One way to characterize change in a system is to say that its objects change their state in response to events and to time

  • e.g. When you throw a switch, a light changes its state from off to on
  • e.g. The update_mark method changes the state of the student subject object
A state diagram shows the various states of a single object
  • There must be a separate transition diagram for each object class
  • It helps analysts, designers and developer understand the behavior of the objects in the system,
  • State diagrams ensure that they won't have to guess about what the object is supposed to do
When do we care about States?

  1. A class has a complex life cycle
  2. Properties of the class may be updated at multiple points in the life cycle
  3. When one class is dependent on the existence or behavior of other classes
  4. When the behavior of a class depends on what previously happened
We can definitely say that state transition diagram show class state and the events that cause them to transition between states.
  • An event happens at a specific time and place
  • Events cause a change of state for the object as the transition "fires"
Each time on object changes state, some of its attributes must change
  • There must be a method in the object class to change the attributes
  • Often there is a boundary or interface class ( a display screen or web form) for the actor to enter the attributes and trigger the Event

State Diagram Definition

A state diagram will represent the changes that can occur in an object. Objects can change their state in response to events and time



Tuesday 5 February 2013

Representing Class Responsibility


  • It is possible to further define a class definition in the UML through the specification of the class's specific responsibilities
  • The responsibility of a class is a description of what the class has to do
  • The description of the class's responsibility is placed inside the class rectangle underneath the class's behaviors
  • The purpose of including this description is to include enough information so that the class is described unambiguously