Study Guide Instructor view
Validation and Verification
Teaching notes for Lesson 5.12, with controls for presenting it.
Keep this page on your own screen. Share only the lesson window. The lesson window holds no teaching notes, so sharing it cannot show them.
Presenting
- Open the lesson in its own window and share that window, not this one.
- Use Next and Previous here, or the lesson’s own, to move through the lesson. Next reveals one thing at a time: the next idea, or the answer to the question on screen, then the next step. Previous takes the last reveal back. The line below says what is on screen and what Next will show.
- Reveal hints and answers when the class is ready, and reset a demonstration before using it again.
The controls need JavaScript and a browser that supports BroadcastChannel. Without them, open the lesson in presentation mode and use its own controls.
The two windows talk to each other only inside this browser, on this device. Nothing is sent to a server, and no account is needed. A second device (a phone or another tablet) cannot follow the lesson window yet.
Now on the lesson window
- On screen
- Next teaching point
Guidance for this point
Lesson plan
- Level
- Intermediate
- Time
- About 90 minutes; the steps below add up to 93
Pupils begin with three different mistakes on one form and discover for themselves that a program can notice impossible data but not plausible-but-wrong data. Only then are validation and verification named, each check is met through a rule pupils write first, and the lesson ends with pupils writing and correcting validation loops of their own.
Objectives
- Explain why a program needs both validation and verification, and say what each can and cannot show
- Describe and apply range, length, type, presence and format checks, and a check digit
- Describe and apply a visual check and a double entry check
- Choose a suitable check for a given input
- Write pseudocode that keeps asking until the input is valid, with a helpful message
- Spot and correct a mistake in a validation loop
Before the lesson
- Mini whiteboards for predictions and for writing short conditions such as Age >= 11 AND Age <= 18.
- A calculator is not needed: the check digit sums are small, but pupils who find the weighted total slow can use a column of products in a trace table.
- Optional: a printed copy of the check digit rule so that pupils can refer to it while completing both tables.
Steps
Introduction Opening
On the lesson window now
On screen: the lesson’s title, module and number; Next adds its objectives and key terms, as the lesson page lists them; Next again begins the first step.
Objectives on screen
- Explain why a program needs both validation and verification, and say what each can and cannot show
- Describe and apply range, length, type, presence and format checks, and a check digit
- Describe and apply a visual check and a double entry check
- Choose a suitable check for a given input
- Write pseudocode that keeps asking until the input is valid, with a helpful message
- Spot and correct a mistake in a validation loop
Purpose: Pupils begin with three different mistakes on one form and discover for themselves that a program can notice impossible data but not plausible-but-wrong data. Only then are validation and verification named, each check is met through a rule pupils write first, and the lesson ends with pupils writing and correcting validation loops of their own.
1. Three mistakes on one form Think 8 min
On the lesson window now
Purpose: Pupils separate mistakes a program can notice from mistakes it cannot, before either idea has a name.
Ask
- Which of Ali, Ben and Cara could the program catch without knowing Mia’s age?
- Why can it not catch the 15?
Responses to expect
- 140 and “fourteen”
- 15 is a possible age, so nothing about it looks wrong
Misconceptions to challenge
- A learner may believe: “The computer knows the right answer, so it can spot every mistake.” Respond: The computer only has the rules it was given. Ask: how would it know Mia’s age?
Checking understanding: Pupils write the three names on a whiteboard and tick the ones a program could catch.
Depending on the answers
- If several pupils say all three can be caught: ask what the program would compare 15 with; return to this at the misconception callout in step 3
Discussion pause: Thirty seconds of silent thinking, then pairs compare answers.
In the lesson window
- Think it through: The program does not know Mia’s real age. Which of the three mistakes could it still notice, and which could it not? Explain why.
2. Rules about what is allowed Discover 10 min
On the lesson window now
Purpose: Pupils write the rules as comparisons before the names range check and length check are given.
Ask
- How do you write “from 11 to 18” as a condition?
- How many characters does a password have, and what does LENGTH give?
Responses to expect
- Age >= 11 AND Age <= 18
- LENGTH(Password) >= 8 AND LENGTH(Password) <= 12
Misconceptions to challenge
- A learner may believe: “Age > 11 AND Age < 18 is the same rule.” Respond: Test 11 and 18 themselves: they should be allowed, so the comparisons need >= and <=.
- A learner may believe: “Only letters count towards a password’s length.” Respond: LENGTH counts every character, digits and symbols included.
On the board or with the pen
- Write the age rule on the board and mark 11 and 18 on a number line.
Checking understanding: The range-passes question shows who includes the limits.
Support
- Give pupils the sentence frame: the age is allowed if it is at least __ and at most __.
In the lesson window
- Think it through: Write each of these two rules as a comparison a program could test, using AND. Use the variable names Age and Password.
- Check your understanding: The range check allows ages from 11 to 18. Which typed age passes it?
- Check your understanding: The password rule allows 8 to 12 characters. Does the password Maths2026! pass the length check?
3. The right kind of data, and some data at all Discover 9 min
On the lesson window now
Purpose: Two more checks, discovered from pupils’ own list of unusable ticket entries, and the key idea that valid does not mean correct.
Ask
- What could a person type in the tickets box that the program cannot use?
- Cara’s 15 passes. Does that make it right?
Responses to expect
- Words, an empty box, decimals, negative numbers
- No: it only follows the rules
Misconceptions to challenge
- A learner may believe: “If data passes validation it must be correct.” Respond: Validation shows only that the data is allowed. Ask for an example that passes but is wrong: Cara’s 15.
- A learner may believe: “A presence check tests that the data is sensible.” Respond: It tests only that something was entered.
Checking understanding: The valid-not-correct question separates pupils who have taken in the limit of validation.
Depending on the answers
- If many pupils choose the first option in valid-not-correct: return to Mia’s real age and ask what the range check actually compared 15 with
In the lesson window
- Think it through: List three different things a person might type, or fail to type, in the “How many tickets?” box that the program cannot use. Why can it not use each?
- Check your understanding: A parent submits the form with the surname box left empty. Which check refuses this?
- Check your understanding: Cara types 15 as Mia’s age, and the program accepts it. What does that tell you?
4. Data that must follow a pattern Discover 10 min
On the lesson window now
Purpose: A format check discovered as a pattern of positions, with the limit that shape is not meaning.
Ask
- Which characters would you look at to test a date?
- Why is 31/02/2026 accepted?
Responses to expect
- Length 10, slashes in positions 3 and 6
- The check tests only the shape
Misconceptions to challenge
- A learner may believe: “A format check knows whether a date really exists.” Respond: It compares characters with a pattern. A different check, with more rules, is needed for real dates.
On the board or with the pen
- Write 05/11/2026 with the positions 1 to 10 numbered underneath.
Support
- Provide a strip of ten boxes so that pupils can write each date in it and count the positions.
English as an additional language
- Check the words position, pattern, slash and hyphen before the question.
In the lesson window
- Think it through: Describe in words a rule a program could test to refuse 5/11/26 and 05-11-2026 but accept 05/11/2026. Which characters would it look at?
- Check your understanding: Why does the format check accept 31/02/2026?
5. Spotting a mistyped number: the check digit Explain 14 min
On the lesson window now
Purpose: The check digit as a calculation the computer can repeat, practised on a small invented rule so that the idea is separate from the real ISBN rule.
Ask
- How could the computer notice a swapped pair of digits when every check so far passes?
- What does the check digit work out to for 31502?
Responses to expect
- A digit worked out from the others can be recalculated and compared
- 7
Misconceptions to challenge
- A learner may believe: “The check digit is a random extra digit.” Respond: It is calculated from the other digits by a fixed rule. Do the sum with the class.
- A learner may believe: “A check digit proves the number is the right one.” Respond: It shows the number is probably typed correctly, not that it belongs to the right member.
On the board or with the pen
- Work the 48213 example in a column: digit, weight, product, then total, remainder and check digit.
Checking understanding: The first TableTask shows who can follow the steps; the second shows who can use the result to accept or reject a number.
Depending on the answers
- If pupils get a remainder of 0 case wrong in later work: recall that the check digit is 0, not 10, when the remainder is 0
Support
- Give the products already filled and ask only for the total, remainder and check digit.
Stretch
- Find two different numbers that give the same check digit. What kinds of typing mistake would go unnoticed?
In the lesson window
- Think it through: A librarian types the card number 842134 instead of 482134 by swapping the first two digits. The typed number has six digits, all of them digits, and it is in the allowed range. How could the computer still notice that something is wrong?
- Check your understanding: What does the program do with the typed number 842134, and why?
6. Is it what was meant? Predict 9 min
On the lesson window now
Purpose: Pupils suggest ways of catching a typo that no validation rule can catch, then meet visual check and double entry as the answers.
Ask
- How could a person catch ali.kahn? How could the program?
- What mistake would pass double entry?
Responses to expect
- Read it back on the screen; type it twice and compare
- The same mistake made twice
Misconceptions to challenge
- A learner may believe: “Verification and validation are two words for the same thing.” Respond: Validation asks if the data is allowed; verification asks if it matches what was meant. Use the DoNotConfuse panel.
Checking understanding: The double-entry-limit question shows who sees that verification compares data with something and is not infallible.
In the lesson window
- Think it through: Suggest two different ways of catching the swapped letters, one that a person does and one that the program does.
- Check your understanding: Ali types ali.kahn@school.example twice, in the same wrong way, and the double entry check passes. What does this show?
7. Writing validation that asks again Explain 12 min
On the lesson window now
Purpose: Pupils decide on the loop before they see it, then follow the REPEAT … UNTIL pattern and a trace.
Ask
- Should the test be before or after the first input?
- Which condition belongs in the IF, and which in the UNTIL?
Responses to expect
- After, so REPEAT … UNTIL
- The IF uses the refused values, the UNTIL the allowed ones
Misconceptions to challenge
- A learner may believe: “UNTIL Age >= 11 OR Age <= 18 is the allowed range.” Respond: Try 9: it is at most 18, so the OR version accepts it. A range needs AND.
- A learner may believe: ““Invalid” is a good enough message.” Respond: Ask what a person who sees it would do next.
On the board or with the pen
- Trace the three ages on the board, one row at a time, predicting each row first.
Checking understanding: The Sam’s loop question diagnoses AND against OR.
Depending on the answers
- If pupils agree with Sam: trace the age 9 through both versions together on the board
In the lesson window
- Think it through: A program must keep asking for the age until a valid one is typed. Should the loop test the age before the first input or after it? Which of the three loops from Lesson 5 would you choose, and why?
- Check your understanding: Sam writes the loop condition UNTIL Age >= 11 OR Age <= 18. What does this version do?
8. Write validation yourself Apply 8 min
On the lesson window now
Purpose: Independent writing: pupils apply the loop to a length check with no worked example for it.
Ask
- Write the loop for a password of 8 to 12 characters.
Responses to expect
- REPEAT … UNTIL with LENGTH and a message
Misconceptions to challenge
- A learner may believe: “The IF and the UNTIL can be the same condition.” Respond: They are opposites: the IF describes a refused value, the UNTIL an allowed one.
Checking understanding: Collect the paper answers and check the IF and UNTIL are opposite.
Support
- Give the first line, REPEAT, and the last line, UNTIL, and ask for the middle.
Stretch
- Add a presence check message for an empty password as well as the length message.
In the lesson window
- Think it through: Write pseudocode that asks for a password and keeps asking until its length is from 8 to 12 characters. Show a helpful message each time a password is refused.
9. Choosing the check Apply 7 min
On the lesson window now
Purpose: Pupils choose checks for new inputs, justifying the choice by the mistake it catches.
Ask
- Which check refuses 4821 as a six-character pupil number?
- Which checks protect a tickets box?
Responses to expect
- A length check
- Presence, type and range together
Misconceptions to challenge
- A learner may believe: “One check is enough for any input.” Respond: Show that “two”, 9 and an empty box each need a different check.
Checking understanding: The three apply questions each diagnose a different mix-up of check names.
English as an additional language
- Display the list of check names with a short example beside each.
In the lesson window
- Apply it: A school’s canteen app asks for the pupil’s year group, which must be from 7 to 11. Which check tests this?
- Apply it: Pupil numbers are always exactly six characters. Someone types 4821. Which check refuses it?
- Apply it: Which set of checks best protects the “How many tickets?” box, which should hold a whole number from 1 to 6?
10. Show what you know Consolidate 6 min
On the lesson window now
Purpose: Explanation in pupils’ own words, then a last new context, before the summary.
Ask
- Explain validation and verification using Mia’s form.
- What kind of check is typing a password twice?
Responses to expect
- Validation: allowed. Verification: matches what was meant; the 15 needs verification
- Double entry, a verification check
Checking understanding: Read two explanations aloud and ask the class which of Ali, Ben and Cara each check would catch.
Depending on the answers
- If several pupils call the password-twice check validation: ask what is compared with what, and return to the DoNotConfuse panel
In the lesson window
- Think it through: Explain the difference between validation and verification to someone who missed the lesson. Use the age on Mia’s form as your example, and say which of Ali’s, Ben’s and Cara’s mistakes each could catch.
- Apply it: A new-account form asks the user to type their chosen password twice and refuses the form if the two differ. What kind of check is this?
Lesson recap Closing
On the lesson window now
On screen: the lesson’s objectives again; Next adds the closing question, which asks the class to explain each one in their own words without looking back. It says nothing about what anyone has learnt: use the answers to decide what to revisit.
Points to listen for
- Validation checks that data is allowed; verification checks that it is what was meant.
- Range, length, type, presence, format and check digit are the six validation checks; visual and double entry are the two verification checks.
- Valid data is not always correct data.
- A validation loop is REPEAT … UNTIL: the IF uses the refused values and the UNTIL the allowed ones.
Consolidation
- Validation checks that data is allowed; verification checks that it is what was meant.
- Range, length, type, presence, format and check digit are the six validation checks; visual and double entry are the two verification checks.
- Valid data is not always correct data.
- A validation loop is REPEAT … UNTIL: the IF uses the refused values and the UNTIL the allowed ones.