A student guide to the OCR H446 programming project. Part 3 of 5: Design (15 marks).
The design is worth 15 marks. It's where you show that you can plan a solution before you build it, using the computational thinking from the course. Your design must follow from your analysis: every success criterion should be covered by something in the design.
What the design must cover
| Part | What you must show |
|---|---|
| 1. Decomposition | The problem broken down into smaller parts that can be solved by computer, and why you broke it down that way |
| 2. Structure | The structure of the whole solution, in detail, with reasons |
| 3. Algorithms | The parts of the solution described with accurate algorithms, and how together they form a complete solution |
| 4. Usability | The usability features you will include, and why |
| 5. Data | The key variables, data structures and classes, with reasons, and the validation needed |
| 6. Test data | The test data for use during development and after it, with reasons |
For the top band, the key word is justify: say why for every choice.
Suggested structure
- Overview and decomposition.
- Structure of the solution (diagram).
- Data design.
- Algorithms.
- User interface and usability features.
- Validation.
- Test data and test plan.
1. Decompose the problem
Break the whole problem into smaller problems, and carry on until each is small enough to code. This is the problem decomposition from section 2.2.2 of the course. Show it as a hierarchy diagram, then explain your reasoning.
Explain the decisions, for example: "Booking and rota are separate because the parents only use bookings and the coach only uses the rota, so each can be built and tested alone. The rule-checking is its own part because both the booking and the rota need it, so it's written once and reused."
Say which parts are:
- Independent, and could be built in any order.
- Dependent on others (the rota needs the bookings and availability data).
- Reusable in several places.
2. Structure of the solution
Describe the overall structure in enough detail that someone else could build it:
- The modules or classes, and what each does.
- How they connect: what data passes between them.
- The layers (interface, logic, data storage).
- Where the data is stored (database, files).
- The flow of the program (a flowchart or diagram of screens).
Justify it: "The GUI is separate from the logic, so that the rules can be tested without the interface, and the interface can be changed without touching the rules."
Classes (if you use OOP)
| Class | Attributes | Methods | Purpose |
|---|---|---|---|
Swimmer |
swimmer_id, name, level |
get_age() |
Represents a swimmer |
Session |
session_id, day, time, lane, capacity |
is_full(), add(swimmer) |
A lesson slot and its bookings |
Coach |
coach_id, name, availability |
is_free(day, time) |
A coach and when they can work |
Rota |
sessions, assignments |
build(), has_clash() |
The weekly timetable |
A class diagram or ER diagram helps. Explain why each class exists.
3. Data design: variables, data structures and classes
Identify the key data and justify the choice of structure.
| Data | Structure | Why |
|---|---|---|
| All swimmers | Table in a database | Many records, needs searching and saving |
| One session's bookings | List of swimmer IDs | Small, ordered, needs adding and removing |
| Coach availability | Dictionary: day to a list of times | Quick look-up by day |
| Rota being built | 2D array (sessions by coaches) | Clear grid, easy to check clashes |
| Undo history | Stack | Last action undone first |
Include a data dictionary for the database or main variables:
| Field | Type | Size/range | Validation | Notes |
|---|---|---|---|---|
name |
text | 1 to 40 characters | Presence, length | |
age |
integer | 5 to 18 | Range | Club rule |
email |
text | Format check | Used for confirmations |
Validation
State what validation each input needs and why: presence, type, range, length, format, lookup and uniqueness. Explain what happens when it fails (a message, ask again).
4. Algorithms
Describe each main part of the solution with an algorithm. Use pseudocode or flowcharts. Then explain how they fit together to form a complete solution to the problem.
- Cover every key process, not just the easy ones.
- Make sure each algorithm is accurate, so that someone could write the code from it.
- Link each to a success criterion.
Example: check a booking against the rules
function canBook(swimmer, session)
if session.isFull() then
return false
endif
if swimmer.level < session.minLevel then
return false
endif
for each other in swimmer.bookings
if other.day == session.day AND other.time == session.time then
return false
endif
next other
return true
endfunction
Explain: "It tests the three rules in turn. It returns false as soon as one fails, so the others aren't checked. This covers SC2 (full sessions) and prevents a swimmer being in two places (SC3)."
Example: build a rota with backtracking
procedure assign(sessionIndex)
if sessionIndex == total then
solutionFound = true
return
endif
for each coach in coaches
if coach.isFree(sessions[sessionIndex]) then
place coach in session
assign(sessionIndex + 1)
if solutionFound then return
remove coach from session // backtrack
endif
next coach
endprocedure
Say why you chose this approach (it's a constraint problem, and backtracking drops bad choices early) and how it compares with alternatives.
Showing a complete solution
Finish with a short summary of how the parts connect: "A parent logs in (A1), chooses a session, and canBook (A2) checks the rules. If it passes, the booking is saved (A3). Each week the coach runs assign (A4) and the rota is displayed (A5)."
5. Usability features
Describe the usability features you'll include, and justify them from your stakeholders' needs.
| Feature | Why |
|---|---|
| Few screens to book (3 at most) | Parents are not experts (SC1) |
| Clear, consistent layout | Less confusion |
| Error messages that say what to do | Users can recover |
| Large buttons and readable text | Older users and small screens |
| Colour plus text (not colour alone) | Colour-blind users |
| Confirmation before a cancel | Prevents mistakes |
| Defaults and drop-down lists | Less typing, fewer errors |
Include screen designs: sketches or wireframes of the main screens, annotated to point out the usability features.
6. Test data
OCR wants you to plan the test data you'll use, and say why. Two stages:
- During iterative development: tests of each part as you build it.
- After development: tests of the whole finished system, including robustness and usability.
Use the three types of test data:
| Type | Meaning | Example (the age field, 5 to 18) |
|---|---|---|
| Normal | Typical valid data | 12 |
| Boundary | On the edge of valid | 5, 18, and just outside: 4, 19 |
| Erroneous | Invalid, should be rejected | -3, "abc", blank |
A test plan table helps, and it links back to the success criteria:
| Test | Criterion | Data | Expected result | Stage |
|---|---|---|---|---|
| Book into a free session | SC1 | A valid swimmer and session | Booking saved | Development |
| Book into a full session | SC2 | A session with 8 swimmers | Rejected with message | Development |
| Age of 19 | Validation | 19 | Rejected | Development |
| Whole rota with 20 sessions | SC3 | Sample week | No coach in two places | Post-development |
| New user books a lesson | SC1 | A parent who hasn't seen it | Done in 3 screens | Usability |
Justify your choices: "I use 5 and 18 because they are the club's age limits, and bugs often appear at boundaries."
How the mark bands rise
| Marks | What it looks like |
|---|---|
| 1 to 4 | Elements described using algorithms, some usability features described, key data and some test data identified |
| 5 to 8 | Decomposition described, structure defined, algorithms and usability described, data and validation identified |
| 9 to 12 | Everything is explained, algorithms form a complete solution, justified data structures and test data |
| 13 to 15 | Everything is justified, including decomposition, algorithms, usability, validation, and test data for both stages |
Checklist before you move on
- The problem is decomposed, with reasons.
- The structure is detailed enough for someone else to build.
- Algorithms cover every key part, and are accurate.
- You've shown how they form a complete solution.
- Data structures and classes are chosen and justified.
- Validation is described.
- Usability features have reasons from the stakeholders.
- Test data covers normal, boundary and erroneous, for development and afterwards.
- Each success criterion is covered by the design.
Common mistakes
- No reasons: describing the design but never saying why.
- Algorithms that are too vague ("sort the list") to be built from.
- Missing the difficult parts and only designing the easy ones.
- No link to the analysis.
- Test data only for normal cases.
- Design copied from the final code instead of being planned first. (The design should come first, and should be updated if it changes, with the reason.)
- No usability features or no screen designs.
Tip: the design is allowed to change as you develop, and agile working expects it. Keep your original design, and when you change it, note what changed and why. This gives you evidence for the "iterative development" section and shows good judgement.
Check yourself
What is decomposition, and how should it be shown in the design?
Breaking a problem into smaller parts that can each be solved. It can be shown with a hierarchy diagram, with an explanation of why it was split that way.
What must the algorithms in the design achieve together?
They must describe the parts of the solution accurately, and together form a complete solution to the problem, with an explanation of how they fit together.
Why justify the choice of data structures?
To show that each one was chosen because it suits how the data is used, such as a dictionary for quick look-up, instead of being picked at random.
What are the two stages for which you need test data?
During iterative development, and after development (testing the finished solution, including robustness and usability).
Name the three types of test data and give an example of each for an age field of 5 to 18
Normal: 12. Boundary: 5, 18 (and 4, 19 just outside). Erroneous: -3 or "abc".