Presentation on theme: "ZEIT2301 Design of Information Systems Behavioural Design: State Machines School of Engineering and Information Technology Dr Kathryn Merrick."— Presentation transcript:
ZEIT2301 Design of Information Systems Behavioural Design: State Machines School of Engineering and Information Technology UNSW@ADFA Dr Kathryn Merrick
2 Topic 06: Behavioural Design Objectives To discuss the role of behavioural models in IS development. To understand the notation, rules and style guidelines for creating behavioural models: This week we will look at state machines Next week we will look at a subset of behavioural models called interaction diagrams: Sequence diagrams communication diagrams To appreciate the relationship between behavioural models and structural and functional models. Reference: Text Ch 7
3 Behavioural Models Behavioural models describe the internal dynamic aspects of an IS that supports business processes in an organization As distinct from: Functional models which depict the external behavioural view Structural models which depict the static view Behavioural modelling focuses on objects whereas structural modelling focuses on classes.
4 Behavioural Models During the analysis phase, behavioural models capture a basic understanding of the dynamic aspects of the underlying business process. Later, behavioural models are enhanced and refined during design phase and implementation details are added. Creating behavioural models, like other models already discussed, is an iterative process. As the behavioural models develop, it may be necessary to re-visit the structural and functional models.
5 Revision: Objects Objects are instantiations (particular instances) of a class: An object has attributes that describe it An object’s state is determined by the value of its attributes An object’s behaviour is described by the operations it can perform (later called methods) Objects can send and receive messages Messages are sent to other objects to tell the object to execute a behaviour – these behaviours become operations of the recipient object
6 State Machines State machines represent the changes in an object’s state (i.e. changes in the values of its attributes).
7 State Machine Diagram State machine diagram – a dynamic model that shows the different states of an object and the events that cause the object to transition from one state to another. State machine are useful for understanding the objects of classes that are very dynamic and complex. It is not necessary to produce state diagrams for objects of every class
8 State Machine Diagram In addition to modelling the states of an object in a class, a state machine diagram may also be used to model changes in the states of: a set of classes a subsystem an entire system (e.g. off, standby, on)
9 Elements of a State Machine Diagram The elements of a state machine are: States Events or actions Transitions
Session 2, 201010 States State – the state of an object is defined by the value of its attributes and its relationships with other objects at a particular point in time. Example: possible states of Patient class: checked-in, admitted, under- observation, released Note: not all attributes or attribute changes will make a difference (e.g. a change in the patient’s address should not determine how the patient is treated.)
11 Events Event – 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. An event can be: a condition becoming true receiving a message from another object to execute an operation (a method call) the passage of a designated period of time The state of an object determines exactly what the response to the event will be. Example: patient (current state ‘under observation’) is diagnosed as healthy, status changes to ‘released’.
12 Transitions Transition – the movement of an object from one state to another. A guard condition is a True/False expression. Transition only takes place if expression is True. Expression includes attributes values Example: a patient transitions from the state ‘under- observation’ to ‘released’ when [Diagnosis = Healthy]
15 Building a State Machine Diagram Steps for building a state machine diagram: Set the context Identify the initial, final, and stable states of the object (class) Determine the order in which the object will pass through the stable states Identify the events, actions, and guard conditions associated with the transitions Validate the state machine diagram
16 State Machine for the Order Class Exercise: Spend a few minutes studying this model. Look for: States, Events, Transitions, Guards
17 State Machine for the Order Class Event State Transition Guard
18 Summary After today’s lecture you should be able to Construct state machine diagrams
Your consent to our cookies if you continue to use this website.