Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modelling state Alan Dix http://www.hcibook.com/alan/topics/formal/

Similar presentations


Presentation on theme: "Modelling state Alan Dix http://www.hcibook.com/alan/topics/formal/"— Presentation transcript:

1 modelling state Alan Dix

2 model based methods describe state using variables types of variables:
basic type: x: Nat – non-negative integer {0,1,2,...} individual item from set: shape: {circle, line, rectangle} subset of bigger set: selection: set Nat – set of integers function (often finite): objects: Nat  Shape_Type

3 define your own types Shape_Type = shape: {circle, line, rectangle}
x, y: Nat – position of centre wid: Nat ht: Nat – size of shape

4 use them to define state
objects: Nat  Shape_Type selection: set Nat – selected objects

5 invariants and initial state
invariants – conditions that are always be true – must be preserved by every operation selection  dom objects – selection must consist of valid objects initial state – how the system starts! objects = {} – no objects selection = {} – selection is empty

6 define operations delete: dom objects' = dom objects – selection
– remove selected objects  id  dom objects' objects'(id) = objects(id) – remaining objects unchanged selection' = {} – new selection is empty  note use of primed variables for ‘new’ state

7 display/presentation
details usually very complex (pixels etc.) … but can define what is visible Visible_Shape_Type = Shape_Type highlight: Bool display: vis_objects: set Visible_Shape_Type vis_objects = { ( objects(id), sel(id) ) | id  dom objects } where sel(id ) = id  selection

8 defining state two problems: too little state too much state
elements missing from specification may be deliberate e.g. dialogue level spec. too much state too many states, too complex state may be deliberate redundancy, extensibility

9 too little state e.g. ‘typing’ flag for calculator forgotten elements
checking: dialogue state can you work out current dialogue state? action specification do you have enough information? implicit global variables (see also later) suggest state missing

10 too much state states are not orthogonal unreachable states
too few actions (see later) constraints spare variables: constant/functional dependent dependent state e.g. first point of line, number being typed indistinguishable states what is observable? states are not orthogonal

11 defining actions framing problems = too little in result state
unreachable states – insufficient actions using ‘global’ variables implicit in operation definition beware extreme cases (e.g. empty document, cursor at end of line)


Download ppt "Modelling state Alan Dix http://www.hcibook.com/alan/topics/formal/"

Similar presentations


Ads by Google