Ch5: Software Specification
1 Dynamic modeling using UML Static models: Dynamic models:
2 Statechart diagrams Objects have both behavior and state: Some objects are more complicated than some other objects.
3 Statechart diagrams (contd..) Depicts: Known as: External vs. internal events: State: Transition: State-space explosion:
4 Notation for statechart diagrams State: Marks a mode of the object Indicated using a rectangle with rounded corners Name of the state is written inside the rectangle Activities that occur in the state may also be represented Indicate the invocation of methods in the state Some activities are performed upon entry, some upon exit and some continuously irrespective of the event which caused to transition to that state. State Activities
5 Notation for statechart diagrams State Entry: method1() Exit: method2() Ev1: method3() Ev2: Method4() Ev1/method3() Ev2/method4()
6 Notation for statechart diagrams (contd..) Transition: Marks the changing of object state Triggered by an internal or external event Represented by a directed arrow from the current state to the next state Event name written above, below or alongside the arrow Action indicates the name of the method that will be invoked upon reaching the next state [EventName] [Guard]/Action
7 Notation for statechart diagrams (contd..) Initial state: State of the object before any transitions State when instantiated Marked using a solid circle Only one initial state is allowed
8 Notation for statechart diagrams (contd..) Final state: End state Marks the destruction of the object Represented using a solid circle with a surrounding circle
9 Notation for statechart diagrams (contd..) Super State: Used when many transitions lead to a certain state Show all the transitions from each state to the given state Super state is used to show that all the states inside the super state transition to the given state State Action State Action
10 Generic statechart diagram State1 do/activity State2 do/activity State3 do/activity Event/[Condition] Event
11 Statechart diagram: Order entry system checking do/check item dispatching do/initiate delivery Waiting cancelled [Not all items checked]/ getNextItem [All items checked && Some items not in stock] Item received [Some item not in stock] delivered [Cancelled] [All items checked && All items available] shipped ItemList
12 Statechart diagram: Order entry system checking do/check item dispatching do/initiate delivery Waiting Cancelled Delivery Super state
13 Statechart diagrams Hierarchical statechart diagrams:
14 Drawing statechart diagrams Initial and final states: Determine the intermediate states that the object can be in: Identify the transitions:
15 Activity diagrams Document workflows in a system States: Transitions:
16 Notation for activity diagrams Activity states: Mark an action by an object Represented using rounded rectangles Same notation as in the statechart diagram Action State
17 Notation for activity diagrams (contd..) Transition Upon completion of one activity state, processing moves to another activity state Transitions mark this movement Represented by a directed arrow
18 Notation for activity diagrams (contd..) Swimlanes: Divide activities according to objects Arrange the objects in the column format Activities by that object are placed in the column Objects at the top of the column, vertical bars separate the columns Customer
19 Notation for activity diagrams (contd..) Initial state: Marks the entry point into the diagram Notation is a solid circle Same as that of a statechart diagram Only one initial state
20 Notation for activity diagrams (contd..) Final state: Mark the end of the modeled workflow Multiple final states Represented using a solid circle surrounded by another circle Same as the statechart diagram
21 Notation for activity diagrams (contd..) Synchronization bar: Parallel activities Split processing (“fork”) or resume processing (“join”) Modeled as solid rectangles Multiple transitions going in and/or out
22 Notation for activity diagrams (contd..) Branch & merge: Represents conditional behavior or branching. Only one of the branches is executed. All branches are followed by a merge to indicate the end of the conditional behavior started by the branch. Represented by a diamond
23 Generic activity diagram Activity1 Activity2 Activity3 Activity4Activity5 Activity6 Fork Branch Merge Join End Start
24 Activity diagram for order processing system Receive order Send invoice Fill Order Overnight Delivery Regular Delivery Receive Payment Close order SalesAgent Stockroom