The Quiz App Challenge
The Notional Machine and Debugging
The “Notional Machine” (aka what the computer does)
A conceptual model, framework, or schema for computing
2. Events and Event Handlers
Questions:
Activity: Sequence and Events
Debugging
Easiest and also very general/powerful way to debug is to insert print statements at various points in the program
This lets you know that the computer’s execution has reached this point
Activity: insert output statements in your program to print a message when a button is pressed or a screen is changed (console.log)
3. State
Computers hold state and programs modify the state.
What is state?
It’s the configuration of things in the computer
Examples of state:
Variables
For our quiz app, we’ll use a variable to hold the number of correct answers
Activity: Extend your quiz app to keep track of number of correct answers.
4. Conditionals
Programs can go down different paths depending on state: aka conditionals
Example: interpreting your score with conditionals
Activity:
Make your final screen shows your result with conditionals, displaying a message like:
Perfect score!
Very close!
Please study more!
A model or conceptual framework (the notional machine) that you can use to understand the computer
Sequence
Events (and event handlers)
State
Conditionals (making decisions based on state)
A useful tool: print statements; console.log
Once you feel comfortable, you can share this concept with your students. When debugging, keep this framework in mind.