Presentation is loading. Please wait.

Presentation is loading. Please wait.

SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.

Similar presentations


Presentation on theme: "SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram."— Presentation transcript:

1 SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26

2 Review UML behavioral Diagrams – Sequence diagram

3 Outline UML Behavioral Diagrams – State Machine Diagram Elements of a State Machine Diagram Creating a State Machine Diagram

4 State Machine Diagram Some of the classes in the class diagrams are quite dynamic in that they pass through a variety of states over the course of their existence. – For example, a vehicle can change over time from being “new” to “pre-owned,” on the basis of its status with the dealership.

5 State Machine Diagram A behavioral state machine diagram is a dynamic model that shows the different states that a single class passes through during its life in response to events, along with its responses and actions.

6 State Machine Diagram What objects are best used with state diagrams? – large, complex objects with a long lifespan – domain ("model") objects – not useful to do state diagrams for every class in the system!

7 State Machine Diagram Typically, behavioral state machine diagrams are not used for all classes, but just to further define complex classes to help simplify the design of algorithms for their methods. The behavioral state machine diagram shows the different states of the class and what events cause the class to change from one state to another.

8 State Machine Diagram In comparison to the sequence diagrams, behavioral state machine diagrams should be used if you are interested in understanding – the dynamic aspects of a single class and – how its instances evolve over time, and – not with how a particular use case scenario is executed over a set of classes.

9 Elements of a Behavioral State Machine Diagram State – A state is a set of values that describes an object at a specific point in time, – and it represents a point in an object’s life in which it satisfies some condition, performs some action, or waits for something to happen.

10 Elements of a Behavioral State Machine Diagram A state is depicted by a state symbol, which is a rectangle with rounded corners with a descriptive label that communicates a particular state.

11 Elements of a Behavioral State Machine Diagram States: – An initial state is shown by a small, solid, filled-in circle, and – An object’s final state is shown as a circle surrounding a small, solid, filled-in circle. The attributes or properties of an object affect the state that it is in; – however, not all attributes or attribute changes will make a difference.

12 Elements of a Behavioral State Machine Diagram Event – An event is something that takes place at a certain point in time and changes a value(s) that describes an object, which in turn changes the object’s state. – It can be a designated condition becoming true, – the receipt of the call for a method by an object, – or the passage of a designated period.

13 Elements of a Behavioral State Machine Diagram A transition – is a relationship that represents the movement of an object from one state to another state. A guard condition – is a Boolean expression that includes attribute values, which allows a transition only if the condition is true.

14 Elements of a Behavioral State Machine Diagram internal activity: – actions that the central object takes on itself – sometimes drawn as self-transitions (events that stay in same state) entry/exit activities – reasons to start/stop being in that state

15

16

17 Super/sub-states When one state is complex, you can include sub- states in it. – drawn as nested rounded rectangles within the larger state Caution: Don't over-use this feature. – easy to confuse separate states for sub-states within one state

18 Creating a Behavioral State Machine Diagram Behavioral state machine diagrams are drawn to depict a single class from a class diagram. Typically, the classes are very dynamic and complex, requiring a good understanding of their states over time and events triggering changes.

19 Creating a Behavioral State Machine Diagram You should examine your class diagram to identify which classes will need to undergo a complex series of state changes and draw a diagram for each of them.

20 Creating a Behavioral State Machine Diagram Identify the States – The first step is to identify the various states that a selected tune will have over its lifetime. – This information is gleaned from reading the use case reports, talking with users, and relying on the requirements-gathering techniques

21 Creating a Behavioral State Machine Diagram Identify the Transitions – The next step is to identify the sequence of states that a selected object will pass through during its lifetime and – then determine exactly what causes each state to occur. – Place state figures on the diagram to represent the states and label the transitions to describe the events that are taking place to cause state changes.

22 Example – Customer Order 1. The customer adds items into the shopping cart. 2. The customer checks out and submits the purchase once he or she is finished. 3. The purchase is pending while payment is authorized. 4. The payment is approved. 5. The purchase is pending for final customer approval. 6. The customer confirms the purchase. 7. The download is released.

23 Example – Customer Order

24 Example - ATM software states

25 Concurrent Substates © Oscar Nierstrasz

26 Branching and Merging Entering concurrent states: – Entering a state with concurrent substates means that each of the substates is entered concurrently (one logical thread per substate). Leaving concurrent states: – A labelled transition out of any of the substates terminates all of the substates. – An unlabelled transition out of the overall state waits for all substates to terminate.

27 Summary UML Behavioral Diagrams – State Machine Diagram Elements of a State Machine Diagram Creating a State Machine Diagram


Download ppt "SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram."

Similar presentations


Ads by Google