2B — Structure It
Build it so it's organized, documented, and hard to break.
This Level Is for You If…
- You're comfortable with the Unit 1 skills in your language, and Unit 1 didn't stretch you much.
- You've met classes (or your language's equivalent) and error handling, in Extended Unit 1 or somewhere else.
- You want to use them in a real program, not just a practice exercise.
What You'll Build
A console program from the problem menu: a calculator-type tool, a quiz engine, or a simple tracker. This time it's designed around at least one class, or your language's equivalent (a struct, an object type, or a module with its own data).
The class should model the main "thing" in your program, like a Quiz, a Tracker or a Converter. It shouldn't just be a wrapper around a function you already had.
Requirements Checklist
Your finished project must include all of these. (Ticking the boxes is just for you, it doesn't save.)
On AI and tutorials: fine to use, as long as your AI Collaboration section records what came from them. When your teacher calls you up, you should be able to explain your class and every method in it.
Checkpoints at 2B
| Checkpoint | What it looks like at 2B |
|---|---|
| CP1 | Pitch; pseudocode; a short description of your class (its attributes and methods) before you code it |
| CP2 | Class works and is used by the main program; error handling in place around at least one input; test table written |
| CP3 | Documentation comments complete; debugger walkthrough in README; all tests recorded; shown to a peer |
Remember to start each checkpoint commit with CP1:, CP2: or CP3:, and push before your teacher calls you up.
How to do the debugger walkthrough
- Pick a bug you actually hit, or a spot where you weren't sure what your code was doing.
- Set a breakpoint on the line before things go wrong. In VS Code, click just left of the line number to add a red dot.
- Start your program under the debugger. For Python, press
F5and choose Python Debugger → Python File. For JavaScript in the browser, open DevTools (F12), go to Sources, and click the same line number. - Look at the variables panel. Step one line at a time, and watch the values change.
- Take a screenshot, and write down what the values were and what that told you.
The last sentence is the important part. "Here's a breakpoint" isn't a walkthrough. "score went back to 0 on every question, so I realized I was resetting it inside the loop" is.
When You're Stuck
- Revisit your Extended or Unit 1 notes on classes and error handling. Python students: your notebooks in
1_foundations/practice. Other languages: your Unit 1 concept log. - Use the debugger, not print statements. Set a breakpoint on the line before things go wrong and watch the variables.
- If your class feels pointless, ask yourself: "What data does this thing hold, and what can it do?" If the answer is "nothing" and "one thing," it might not need to be a class yet.
- Keep error handling small. Wrap the one line that can fail, not the whole program. Otherwise you'll hide real bugs.
Done Looks Like…
Your main program reads almost like plain English, because the class does the heavy lifting. Bad input gets a friendly message every time. Someone could read your documentation comments and use your class without reading the code inside it.