Coding · Grade 8
Testing, Debugging and Secure Design
Learners make the garden app trustworthy: they design thorough unit tests that cover normal, edge and invalid inputs and every branch, debug systematically with tracebacks, minimal failing examples and assertions, and apply secure design principles (input validation, least privilege, safe defaults, failing securely, careful error messages). They finish by seeing why passwords are stored as hashes and why data must be kept separate from commands.
- 4 lessons
- About 90 minutes
- Check what you learned: 8 questions
- Ways to answer: choose an answer, trace code, highlight a text, match pairs, put in order and sort into groups
What learners will discover
- Design unit tests that cover normal, edge and invalid inputs and every branch, and judge how thorough a suite is.
- Debug systematically using tracebacks, minimal failing examples, assertions and regression tests.
- Apply secure design principles: validate untrusted input, least privilege, safe defaults, fail securely and avoid leaking information.
- Explain why passwords are stored as salted hashes and why user data must be kept separate from commands.
Lessons
-
Thorough unit tests 5 steps2 practiceabout 22 min
-
Debugging systematically 5 steps3 practiceabout 20 min
-
Secure design principles 5 steps3 practiceabout 20 min
-
Protecting passwords and commands 5 steps3 practiceabout 18 min
-
Check what you learned 8 questions at the end
Keep exploring
Games to practice with
- Bug DetectiveA robot program almost works. Run it, spot the buggy block, and fix it.
- Sorting FactoryTurn a work order into if/else rules and watch the conveyor sort every item.
- Garden AutomationProgram a garden robot with sensor rules — then watch a whole day play out.
More 8th grade coding
- 8th Grade Coding Games4 games to play free
- 8th Grade Coding Worksheets10 printable worksheets
Guide for grown-ups
- How to start homeschooling: a step-by-step guide for familiesA guide for parents · 7 min read