SlideShare a Scribd company logo
1 of 17
 modelling state
looking within


what is state
that in the present
of that in the past
which affects that of the future
time
modelling state
describe state using variables
– a bit like programming
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
– user defined:
Point = x, y: Real – e.g. (1.79,-3.2)
also:
Int – pos or neg integer
Real – fractional number
String, etc.
stages
iteratively define:
state – what needs to be remembered
invariants – what is always true
initial state – how it starts
actions – what can happen to the state
(need to relate these to mouse, keys, etc.)
display – what the user sees (hears etc.)
use scenarios to check they are what you want
example: car clock
three buttons:
mode – cycles between hours, mins, seconds
+/– – increments/decrements selected item
we will define state and actions
N.B. will not be right first time ... spot the mistakes ...
16:55:00
mode – +
clock state – first attempt
state
hours: Nat
mins: Nat – all just numbers
secs: Nat
hours < 24 ∧ mins < 60 ∧ secs < 60
initial state
hours = 0
mins = 0
secs= 0
display
hours “:” mins “:” secs
invariant
clock actions – first attempt
increment (+)
add 1 to selected item
others unchanged
decrement (–)
similar
mode
cycle selected item
what is it?
clock state – second attempt
state
hours: Nat, mins: Nat, secs: Nat – all just numbers
selected: { ‘NONE’, ‘HRS’, ‘MINS’, ‘SECS’ }
hours < 24 ∧ mins < 60 ∧ secs < 60
initial state
hours = 0, mins = 0, secs= 0
selected = ‘NONE’
display
hours “:” mins “:” secs (with selected flashing)
clock actions – second attempt
increment (+)
if ( selected = ‘NONE’ ) do nothing
if ( selected = ‘HRS’ ) hours’ = hours+1
...
decrement (–)
similar
mode
if ( selected = ‘NONE’ ) selected’ = ‘HRS’
...
variable with apostrophe
(called ‘prime’)
is state after action
clock– scenario
time is 22:58:33
user types: mode mode + +
action selected hours mins secs
NONE 22 58 33
mode
HRS 22 58 33
mode
MINS 22 58 33
increment (+)
MINS 22 59 33
increment (+)
MINS 22 60 33
!!!
clock actions – third attempt
increment (+)
if ( selected = ‘NONE’ ) do nothing
if ( selected = ‘HRS’ )
if ( hours < 23 ) hours’ = hours+1
if ( hours = 23 ) hours’ = 0
if ( selected = ‘MINS’ )
if ( mins< 59 ) mins’ = mins+1
if ( mins= 59 ) mins’ = 0
...
clock– scenario revisited
time is 22:58:33
user types: mode mode + +
action selected hours mins secs
NONE 22 58 33
mode
HRS 22 58 33
mode
MINS 22 58 33
increment (+)
MINS 22 59 33
increment (+)
MINS 22 0 33
but does this want
to become 23?
defining state
two problems:
• too little 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
too little state
forgotten elements
e.g. ‘selected’ mode in car clock
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
too much state
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
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)
internal and external consistency
state
scenarios
actions
invariants preserved?
actions complete?
missing state?
makes sense?
general
properties
specific
examples 


More Related Content

Similar to Modelling the State of a Digital Clock

REAL TIME OPERATING SYSTEM PART 1
REAL TIME OPERATING SYSTEM PART 1REAL TIME OPERATING SYSTEM PART 1
REAL TIME OPERATING SYSTEM PART 1Embeddedcraft Craft
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for SpeedYung-Yu Chen
 
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Dan Robinson
 
Tues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiy
Tues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiyTues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiy
Tues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiyAnton Yazovskiy
 
Polyglot Persistence in the Real World: Cassandra + S3 + MapReduce
Polyglot Persistence in the Real World: Cassandra + S3 + MapReducePolyglot Persistence in the Real World: Cassandra + S3 + MapReduce
Polyglot Persistence in the Real World: Cassandra + S3 + MapReducethumbtacktech
 
iv. minggu keempat
iv. minggu keempativ. minggu keempat
iv. minggu keempatIsna Aryanty
 
JAVA.Q4 Create a Time class. This class will represent a point in.pdf
JAVA.Q4 Create a Time class. This class will represent a point in.pdfJAVA.Q4 Create a Time class. This class will represent a point in.pdf
JAVA.Q4 Create a Time class. This class will represent a point in.pdfkarymadelaneyrenne19
 

Similar to Modelling the State of a Digital Clock (12)

Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
REAL TIME OPERATING SYSTEM PART 1
REAL TIME OPERATING SYSTEM PART 1REAL TIME OPERATING SYSTEM PART 1
REAL TIME OPERATING SYSTEM PART 1
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
 
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
 
Tues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiy
Tues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiyTues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiy
Tues 115pm cassandra + s3 + hadoop = quick auditing and analytics_yazovskiy
 
Polyglot Persistence in the Real World: Cassandra + S3 + MapReduce
Polyglot Persistence in the Real World: Cassandra + S3 + MapReducePolyglot Persistence in the Real World: Cassandra + S3 + MapReduce
Polyglot Persistence in the Real World: Cassandra + S3 + MapReduce
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
iv. minggu keempat
iv. minggu keempativ. minggu keempat
iv. minggu keempat
 
JAVA.Q4 Create a Time class. This class will represent a point in.pdf
JAVA.Q4 Create a Time class. This class will represent a point in.pdfJAVA.Q4 Create a Time class. This class will represent a point in.pdf
JAVA.Q4 Create a Time class. This class will represent a point in.pdf
 
Week08.pdf
Week08.pdfWeek08.pdf
Week08.pdf
 
Bb2
Bb2Bb2
Bb2
 
2 презентация rx java+android
2 презентация rx java+android2 презентация rx java+android
2 презентация rx java+android
 

More from Alan Dix

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Human-Centred Artificial Intelligence – Malta 2024
Human-Centred Artificial Intelligence – Malta 2024Human-Centred Artificial Intelligence – Malta 2024
Human-Centred Artificial Intelligence – Malta 2024Alan Dix
 
The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024Alan Dix
 
Qualitative–Quantitative reasoning and lightweight numbers
Qualitative–Quantitative reasoning and lightweight numbersQualitative–Quantitative reasoning and lightweight numbers
Qualitative–Quantitative reasoning and lightweight numbersAlan Dix
 
Invited talk at Diversifying Knowledge Production in HCI
Invited talk at Diversifying Knowledge Production in HCIInvited talk at Diversifying Knowledge Production in HCI
Invited talk at Diversifying Knowledge Production in HCIAlan Dix
 
Exceptional Experiences for Everyone
Exceptional Experiences for EveryoneExceptional Experiences for Everyone
Exceptional Experiences for EveryoneAlan Dix
 
Inclusivity and AI: opportunity or threat
Inclusivity and AI: opportunity or threatInclusivity and AI: opportunity or threat
Inclusivity and AI: opportunity or threatAlan Dix
 
Hidden Figures architectural challenges to expose parameters lost in code
Hidden Figures architectural challenges to expose parameters lost in codeHidden Figures architectural challenges to expose parameters lost in code
Hidden Figures architectural challenges to expose parameters lost in codeAlan Dix
 
ChatGPT, Culture and Creativity simulacrum and alterity
ChatGPT, Culture and Creativity simulacrum and alterityChatGPT, Culture and Creativity simulacrum and alterity
ChatGPT, Culture and Creativity simulacrum and alterityAlan Dix
 
Why pandemics and climate change are hard to understand and make decision mak...
Why pandemics and climate change are hard to understand and make decision mak...Why pandemics and climate change are hard to understand and make decision mak...
Why pandemics and climate change are hard to understand and make decision mak...Alan Dix
 
Beyond the Wireframe: tools to design, analyse and prototype physical devices
Beyond the Wireframe: tools to design, analyse and prototype physical devicesBeyond the Wireframe: tools to design, analyse and prototype physical devices
Beyond the Wireframe: tools to design, analyse and prototype physical devicesAlan Dix
 
Forever Cyborgs – a long view on physical-digital interaction
Forever Cyborgs – a long view on physical-digital interactionForever Cyborgs – a long view on physical-digital interaction
Forever Cyborgs – a long view on physical-digital interactionAlan Dix
 
Truth in an Age of Information
Truth in an Age of InformationTruth in an Age of Information
Truth in an Age of InformationAlan Dix
 
Rome Seminar: Designing User Interactions with AI
Rome Seminar: Designing User Interactions with AIRome Seminar: Designing User Interactions with AI
Rome Seminar: Designing User Interactions with AIAlan Dix
 
Tools and technology to support rich community heritage
Tools and technology to support rich community heritageTools and technology to support rich community heritage
Tools and technology to support rich community heritageAlan Dix
 
Maps with Meaning
Maps with MeaningMaps with Meaning
Maps with MeaningAlan Dix
 
Democratising Digitisation Tools to Support Small Community Archives
Democratising Digitisation Tools to Support Small Community ArchivesDemocratising Digitisation Tools to Support Small Community Archives
Democratising Digitisation Tools to Support Small Community ArchivesAlan Dix
 
Follow your nose: history frames the future
Follow your nose: history frames the futureFollow your nose: history frames the future
Follow your nose: history frames the futureAlan Dix
 
What Next for UX Tools: from screens to smells, from sketch to code, supporti...
What Next for UX Tools: from screens to smells, from sketch to code, supporti...What Next for UX Tools: from screens to smells, from sketch to code, supporti...
What Next for UX Tools: from screens to smells, from sketch to code, supporti...Alan Dix
 

More from Alan Dix (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Human-Centred Artificial Intelligence – Malta 2024
Human-Centred Artificial Intelligence – Malta 2024Human-Centred Artificial Intelligence – Malta 2024
Human-Centred Artificial Intelligence – Malta 2024
 
The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024The future of UX design support tools - talk Paris March 2024
The future of UX design support tools - talk Paris March 2024
 
Qualitative–Quantitative reasoning and lightweight numbers
Qualitative–Quantitative reasoning and lightweight numbersQualitative–Quantitative reasoning and lightweight numbers
Qualitative–Quantitative reasoning and lightweight numbers
 
Invited talk at Diversifying Knowledge Production in HCI
Invited talk at Diversifying Knowledge Production in HCIInvited talk at Diversifying Knowledge Production in HCI
Invited talk at Diversifying Knowledge Production in HCI
 
Exceptional Experiences for Everyone
Exceptional Experiences for EveryoneExceptional Experiences for Everyone
Exceptional Experiences for Everyone
 
Inclusivity and AI: opportunity or threat
Inclusivity and AI: opportunity or threatInclusivity and AI: opportunity or threat
Inclusivity and AI: opportunity or threat
 
Hidden Figures architectural challenges to expose parameters lost in code
Hidden Figures architectural challenges to expose parameters lost in codeHidden Figures architectural challenges to expose parameters lost in code
Hidden Figures architectural challenges to expose parameters lost in code
 
ChatGPT, Culture and Creativity simulacrum and alterity
ChatGPT, Culture and Creativity simulacrum and alterityChatGPT, Culture and Creativity simulacrum and alterity
ChatGPT, Culture and Creativity simulacrum and alterity
 
Why pandemics and climate change are hard to understand and make decision mak...
Why pandemics and climate change are hard to understand and make decision mak...Why pandemics and climate change are hard to understand and make decision mak...
Why pandemics and climate change are hard to understand and make decision mak...
 
Beyond the Wireframe: tools to design, analyse and prototype physical devices
Beyond the Wireframe: tools to design, analyse and prototype physical devicesBeyond the Wireframe: tools to design, analyse and prototype physical devices
Beyond the Wireframe: tools to design, analyse and prototype physical devices
 
Forever Cyborgs – a long view on physical-digital interaction
Forever Cyborgs – a long view on physical-digital interactionForever Cyborgs – a long view on physical-digital interaction
Forever Cyborgs – a long view on physical-digital interaction
 
Truth in an Age of Information
Truth in an Age of InformationTruth in an Age of Information
Truth in an Age of Information
 
Rome Seminar: Designing User Interactions with AI
Rome Seminar: Designing User Interactions with AIRome Seminar: Designing User Interactions with AI
Rome Seminar: Designing User Interactions with AI
 
Tools and technology to support rich community heritage
Tools and technology to support rich community heritageTools and technology to support rich community heritage
Tools and technology to support rich community heritage
 
Maps with Meaning
Maps with MeaningMaps with Meaning
Maps with Meaning
 
Democratising Digitisation Tools to Support Small Community Archives
Democratising Digitisation Tools to Support Small Community ArchivesDemocratising Digitisation Tools to Support Small Community Archives
Democratising Digitisation Tools to Support Small Community Archives
 
Follow your nose: history frames the future
Follow your nose: history frames the futureFollow your nose: history frames the future
Follow your nose: history frames the future
 
What Next for UX Tools: from screens to smells, from sketch to code, supporti...
What Next for UX Tools: from screens to smells, from sketch to code, supporti...What Next for UX Tools: from screens to smells, from sketch to code, supporti...
What Next for UX Tools: from screens to smells, from sketch to code, supporti...
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Modelling the State of a Digital Clock

  • 1.  modelling state looking within  
  • 2. what is state that in the present of that in the past which affects that of the future time
  • 3. modelling state describe state using variables – a bit like programming 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 – user defined: Point = x, y: Real – e.g. (1.79,-3.2) also: Int – pos or neg integer Real – fractional number String, etc.
  • 4. stages iteratively define: state – what needs to be remembered invariants – what is always true initial state – how it starts actions – what can happen to the state (need to relate these to mouse, keys, etc.) display – what the user sees (hears etc.) use scenarios to check they are what you want
  • 5. example: car clock three buttons: mode – cycles between hours, mins, seconds +/– – increments/decrements selected item we will define state and actions N.B. will not be right first time ... spot the mistakes ... 16:55:00 mode – +
  • 6. clock state – first attempt state hours: Nat mins: Nat – all just numbers secs: Nat hours < 24 ∧ mins < 60 ∧ secs < 60 initial state hours = 0 mins = 0 secs= 0 display hours “:” mins “:” secs invariant
  • 7. clock actions – first attempt increment (+) add 1 to selected item others unchanged decrement (–) similar mode cycle selected item what is it?
  • 8. clock state – second attempt state hours: Nat, mins: Nat, secs: Nat – all just numbers selected: { ‘NONE’, ‘HRS’, ‘MINS’, ‘SECS’ } hours < 24 ∧ mins < 60 ∧ secs < 60 initial state hours = 0, mins = 0, secs= 0 selected = ‘NONE’ display hours “:” mins “:” secs (with selected flashing)
  • 9. clock actions – second attempt increment (+) if ( selected = ‘NONE’ ) do nothing if ( selected = ‘HRS’ ) hours’ = hours+1 ... decrement (–) similar mode if ( selected = ‘NONE’ ) selected’ = ‘HRS’ ... variable with apostrophe (called ‘prime’) is state after action
  • 10. clock– scenario time is 22:58:33 user types: mode mode + + action selected hours mins secs NONE 22 58 33 mode HRS 22 58 33 mode MINS 22 58 33 increment (+) MINS 22 59 33 increment (+) MINS 22 60 33 !!!
  • 11. clock actions – third attempt increment (+) if ( selected = ‘NONE’ ) do nothing if ( selected = ‘HRS’ ) if ( hours < 23 ) hours’ = hours+1 if ( hours = 23 ) hours’ = 0 if ( selected = ‘MINS’ ) if ( mins< 59 ) mins’ = mins+1 if ( mins= 59 ) mins’ = 0 ...
  • 12. clock– scenario revisited time is 22:58:33 user types: mode mode + + action selected hours mins secs NONE 22 58 33 mode HRS 22 58 33 mode MINS 22 58 33 increment (+) MINS 22 59 33 increment (+) MINS 22 0 33 but does this want to become 23?
  • 13. defining state two problems: • too little 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
  • 14. too little state forgotten elements e.g. ‘selected’ mode in car clock 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
  • 15. too much state 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
  • 16. 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)
  • 17. internal and external consistency state scenarios actions invariants preserved? actions complete? missing state? makes sense? general properties specific examples  