A student guide to the OCR H446 programming project. Part 4 of 5: Developing the solution (25 marks).
This is the biggest section: 25 marks. It is split into two parts:
| Part | Marks | What it is about |
|---|---|---|
| Iterative development | 15 | Evidence of building the solution in stages, with annotated code and prototypes |
| Testing to inform development | 10 | Testing at each stage, failed tests and the fixes you made |
The most important thing to understand is that OCR marks the evidence in your report, not the program on its own. You must show how the solution was built, explain what you did, and justify why. So you need to collect evidence as you go.
Part A: Iterative development (15 marks)
What "iterative" means
You build the solution in stages (iterations). Each iteration:
- Plans a small part (linked to your decomposition in the design).
- Builds it.
- Tests it.
- Reviews it, and decides what to change.
- Moves to the next part, often improving earlier parts too.
This is the agile approach. Each stage produces a working prototype. Work in order of importance: get the essential features working first, then add the extras.
The evidence you need
For each stage, include:
| Evidence | What it shows |
|---|---|
| What you were trying to do, linked to the analysis and design | The stage has a purpose |
| Annotated code: key sections with comments explaining what and why | You understand it |
| Screenshots of the prototype working | It really ran |
| Decisions you made, and the reasons | Justification |
| Problems you met and how you solved them | Real development |
| A review: what works, what doesn't, what is next | Agile reflection |
Include prototype versions: keep screenshots or copies of the code at each stage, so the report shows how the program grew. Remember that your evidence must be assessable without special hardware or software, so use images and code listings in the report.
Quality of the code
OCR looks for particular qualities in the code itself:
| Quality | What to do |
|---|---|
| Structure and modularity | Split the program into subroutines, classes and modules, each with one job (see the decomposition in your design) |
| Annotation | Add comments that explain key parts. For the top band, comments should help someone maintain the program later |
| Naming | Meaningful names for variables, functions, classes and structures |
| Validation | Check inputs for all key parts, not just a few |
| Efficiency | Avoid needlessly slow or repeated code |
| Review | Show you reviewed the code at each key stage |
Example of annotated code
def can_book(swimmer, session):
"""Return True if the swimmer may join the session.
Checks the three club rules, in order, and stops at the
first one that fails (SC2, SC3).
"""
if session.is_full(): # rule 1: max 8 per lane
return False
if swimmer.level < session.min_level:
return False # rule 2: right ability
for other in swimmer.bookings: # rule 3: no clashes
if other.day == session.day and other.time == session.time:
return False
return True
Notice the docstring, named variables, comments on the rules, and a link to the success criteria.
Show the process, not only the end
| Weaker | Stronger |
|---|---|
| Only the final code | A series of prototypes, each explained |
| "I wrote the login." | "I wrote the login using hashed passwords (SC4), because storing plain text is unsafe. My first version let blank passwords through, so I added a presence check." |
| Code with no comments | Code with comments that explain |
| Everything in one long file | Modules and classes |
| No mention of review | A review after each stage |
Linking to the analysis and design
For the higher bands, relate each stage to the breakdown of the problem from your analysis and design: "This iteration implements 'Check rules' from my decomposition, which meets SC2 and SC3." This shows the solution was built to a plan.
Keep working records as you go
- Use version control (such as Git) or save dated copies of your code.
- Take screenshots as you finish each stage.
- Keep a development log: a short entry per session of what you did, what went wrong and what you decided.
Part B: Testing to inform development (10 marks)
You test during development, at each stage, to find faults and improve the solution. This is different from the testing at the end (guide 5).
What to show
- Evidence of testing at each stage of development.
- Evidence of failed tests, and what you did about them (the remedial action), with reasons for your decisions.
OCR rewards failures that you found and fixed: they show testing was real. Don't hide them, and don't invent perfect results.
Planning the tests
Use the test plan from your design, and add to it. For each test:
| Part of the test | What to record |
|---|---|
| What is tested and why | Linked to a success criterion |
| Test data | Normal, boundary and erroneous |
| Expected result | Worked out before you run it |
| Actual result | What really happened (with a screenshot if you can) |
| Outcome | Pass or fail |
| Action | For a fail: what you changed, and why |
Example
| Test | Data | Expected | Actual | Result |
|---|---|---|---|---|
| Book into a free session | Swimmer 4, session 12 | Booking saved | Saved | Pass |
| Book into a full session | Session with 8 | Rejected with message | Crashed: KeyError |
Fail |
| Age 19 | 19 | Rejected | Accepted | Fail |
| Age 18 (boundary) | 18 | Accepted | Accepted | Pass |
Remedial action: "Test 2 crashed because is_full looked up a session that had no bookings yet. I changed the code to return False for an empty session. I chose to fix is_full rather than catch the error where it was used, because other parts also call it. Re-test: Pass (screenshot 14). Test 3 accepted 19 because I used <= 19 instead of <= 18. Fixed, and re-tested."
Notice the reason for the choice, and the re-test that proves it worked.
Good habits
- Test small parts as you build them, not everything at the end.
- Test boundaries and invalid data, not just the normal case.
- Re-test after each fix, and run earlier tests again to check nothing else broke (this is regression testing).
- Write the expected result first.
- Link tests to your success criteria.
How the mark bands rise
Iterative development (15)
| Marks | What it looks like |
|---|---|
| 1 to 4 | Some evidence of iteration. A linear, possibly inefficient solution, poor naming, little validation, little review |
| 5 to 8 | Evidence for most stages, described. Some structure, brief annotation, mostly good names, basic validation, some review |
| 9 to 12 | Evidence for each stage, linked to the breakdown of the problem, with some prototypes. Modular, annotated, most validation, review at most stages |
| 13 to 15 | Evidence explained and justified, prototypes for each stage. Well structured and modular, annotated to aid maintenance, all names good, validation for all key parts, review at all key stages |
Testing to inform development (10)
| Marks | What it looks like |
|---|---|
| 1 to 2 | Some evidence of testing |
| 3 to 5 | Some testing, some failed tests and fixes |
| 6 to 8 | Testing at most stages, some failed tests with fixes explained |
| 9 to 10 | Testing at each stage, failed tests and fixes with full justification |
Checklist before you move on
- The solution was built in stages, with a prototype for each.
- Every stage has annotated code and screenshots.
- You explain what you did and why, and link it to the design.
- The code is modular, with good names and comments.
- Validation covers all key inputs.
- You reviewed the work at each key stage.
- Tests are recorded at each stage, including failures and fixes with reasons.
- Fixes were re-tested.
Common mistakes
- Showing only the finished program.
- No annotation, or comments that only repeat the code ("add 1 to x").
- One huge block of code with no structure.
- Hiding failures, or tests that all conveniently pass.
- No reasons for decisions.
- Writing the evidence afterwards from memory.
- Testing only with normal data.
- Not linking the development to the plan.
Tip: make every iteration produce the same four things: a screenshot, a short explanation with reasons, a few annotated lines of key code, and a test with its result. If you do that each time, 25 marks of evidence almost write themselves.
Check yourself
How are the 25 marks for developing the solution split?
15 for iterative development of the coded solution, and 10 for testing to inform development.
What evidence should you provide for each stage of iterative development?
What you were trying to do, annotated code, screenshots of the prototype, the decisions made with reasons, problems met and how they were solved, and a review.
Why are failed tests valuable in your report?
They show that testing was real, and, with the remedial action and reasons, they demonstrate how testing informed the development.
What qualities does OCR look for in the code itself?
Modular structure, annotation that aids maintenance, meaningful names, validation of all key inputs, and evidence of review.
Why re-test after fixing a fault?
To prove the fix worked, and to check that it didn't break something that worked before (regression testing).