Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 1 Getting Dynamic, State Machine Diagram PB007 Software Engineering I Lukáš Daubner daubner@mail.muni.cz A picture containing text Description automatically generated Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 2 State Machine Diagram ̶Models the dynamic behavior (life cycle) of one subject ̶Class instantiation (Object) ̶Use Case ̶System ̶Subsystem ̶Component ̶… ̶ ̶Main components are: ̶States ̶Transitions ̶Events A close up of a screen Description automatically generated State Event Transition Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 3 States State Machine Diagram ̶Represents semantically important situation ̶In case of (OOP) object, it is determined by attribute values, relations with others, and performed activity. Graphical user interface, text, application, chat or text message Description automatically generated Entry action Performed when entering the state Exit action Performed when exiting the state Internal activity Ongoing behavior while in the state Deferrable Trigger Event, which is registered but its processing is left for other states Internal Transition Transition, which is processed without exiting the sate Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 4 Transitions State Machine Diagram ̶Defines how to get from one state to another ̶Syntax: event [guard condition] / action ̶Semantics: At the occurrence of event, if the guard condition holds, perform action and go to the new state. A screen shot of a computer Description automatically generated Event Condition (bool) Action Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 5 Events State Machine Diagram ̶Stimulus on which the subject may react by changing the state or performing an operation. ̶ ̶Types of events: ̶Call event – Calling operation of the subject. ̶Signal event – Asynchronous sending a receiving a signal between subjects ̶Change event – Boolean expression. The event occurs when the value is changed from false to true. ̶Time event – Event occur at a certain time t (when(t)) or after a certain time t (after(t)). Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 6 Events State Machine Diagram Graphical user interface, text, application, chat or text message Description automatically generated (excerpt from diagram) Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 7 Simple composite state Composite States ̶Useful for simplifying the diagram ̶Capturing inheritance between states ̶Consist of a single region Diagram Description automatically generated Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 8 Orthogonal composite state Composite States ̶Capturing parallel behavior ̶Consist of a two and more regions ̶ ̶ Diagram Description automatically generated Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 9 State Machine Diagram in OOP world ̶In our case, state machine diagram is used to represent lifecycle of an object ̶Context of the diagram is only the instance of a class from design class diagram ̶All methods and events must be supported by the design class diagram ̶Initial transition means calling the constructor ̶Final transition means deleting the object from system ̶Object saves its state even outside main memory (persistence) Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 10 State Machine Diagram in OOP world Adobe Systems PB007 Software Engineering I — Getting Dynamic, State Machine Diagram 11 You gotta do what you gotta do Task for this week ̶Process the feedback ̶ ̶Choose a suitable object for modeling - ride ̶Something with non-trivial lifecycle ̶ ̶Create a state machine diagram for this object ̶Revise design class diagram if needed ̶