State-based Design Flashcards
What is meant by a state-based system?
reactive system that behaves differently to evetns depending on what state its in
How do we describe a reacitve system?
- Events; requests handled by system
- Actions; performed in repsonse to events
- States; affect how system responds
- Transitions; routes that exit/enter states
What is meant by the alphabet of a state machine?
- Set of all events
What is meant by “Completing a Machine”?
Add in to a state machine diagram all missing transitions from the alphabet
What can be specified by a state machine?
Can capture different levels of abstraction: high level control and low level behaviour
What is contained in a UML Frame label?
frame type code
name of UML element
What is the difference between a Behavioural State MAchine and a Protocol State MAchine?
Behavioural:
- illustrates reactive behaviour
- shows how different ations are triggered by events
- missing transitions are ignored events
Protocol:
- illustrate protocol of class/interface
- shows allowed sequence of messages
- missing transitions are disallowed messages
Why is nondeterminism an issue? WHat is a fix?
Means to next state is unknown, could choose arbitrary transition out of options
Use preconditions; add guards to each conflicting tranisition
How are events presented to a UML state machine?
one at a time
How are transitions enabled in a UML state machine?
- transitions exiting active state are enabled if event trigger matches the event
- once enabled the transition is then fired, event is consumed and a new event is presented
What is meant by “Run-to-Completion” when refering to state machine semantics?
All triggered events must be processed before the triggering event is considered finished
What are the 2 methods of composing state machines?
- have substate machine inside a superstate
- concurrent state machines; 2 independent state machines inside a state.
With nested UML state machines, which transitions take precedence if there is a name coflict? substate or superstate
Substate; to do with inheritance & overriding
Where do we enter/exit a substate?
Enter at default initial state
Can exit from any/all active substates
How can a child subclass be compatible with its parent superclass?
- must exist in same states as parent
- must repsond to same transitions as parent
- new states must be substates of parent states