c. Practical Examples
Responsible Programming and Code Quality
These examples use a light I do - We do - You do model. The goal is not just to read the answer, but to practise noticing problems, naming them correctly, and improving code or decisions step by step.
Example 1 - I do: Checking an AI-generated code snippet
string n = "";
int score = Convert.ToInt32(Console.ReadLine());
if (score > 0 || score <= 100)
{
Console.WriteLine("Accepted");
}
Try first
Before opening the teacher walkthrough, write down:
- one logic problem
- one readability or maintainability problem
- one change you would make first
Teacher walkthrough
When I inspect this code, I would point out:
- The logic is incorrect. The condition uses
||, so almost every number will be accepted. A valid score check should normally use&&. - The variable name is weak.
ntells the reader almost nothing. - There is no prompt to the user. The program expects input without explaining what is required.
- The code is difficult to maintain. Another programmer would need to infer the purpose of the snippet from context.
One possible improved version
Focus: AI-generated code still needs human checking for logic, readability and maintainability.
Exam link: Students should be able to evaluate AI-generated or copied code rather than assuming it is correct.
Example 2 - We do: Improving readability and maintainability
Starting version
Try first
Before opening the model answer:
- rename each variable so its purpose is clear
- improve the output line
- add spacing so the code is easier to read
One possible improved version
What changed?
- variable names now describe purpose
- the output message is clearer
- spacing makes the code easier to scan
- the program is easier to revisit later
We do prompt
Compare your version with the model answer. If yours is different but still clear and meaningful, that is fine. The goal is clarity, not one exact wording.
Focus: Readability supports maintainability.
Exam link: Naming, formatting and clarity are common "explain why" points in short-answer questions.
Example 3 - We do: Deciding whether low-code is suitable
Scenario
A teacher wants a simple form that lets students submit their name, class and topic preference for a coding workshop. The form needs to be built quickly and the data only needs to be stored in a simple list.
Try first
Decide:
- Would you choose low-code here: yes, no, or maybe?
- What is your strongest reason?
- What maintenance risk would still need attention?
One possible model response
A low-code tool could be suitable here because:
- the interface is simple
- development speed matters
- the logic is straightforward
- the first version does not need complex custom processing
Even in a low-code tool, the developer still needs to consider:
- whether the data is stored safely
- whether the form is clear for users
- whether the solution can be maintained later
Focus: Low-code speeds up development, but it does not remove the need for good design decisions.
Exam link: Students should justify why a tool is or is not suitable for a particular situation.
Example 4 - You do: Legal check before reuse
Scenario
A student wants to use:
- a background image copied from a Google search
- a code sample from a public tutorial site
- an open-source library with clear licence terms
Your task
For each item, decide:
- Can it be used immediately?
- Does the licence or copyright need to be checked?
- What action should the student take before including it in a folio solution?
Retrieval Prompt
Before looking anything up, try to explain from memory what copyright and intellectual property mean in software development.
Focus: Responsible reuse means checking ownership and licence conditions before adding third-party material.
Exam link: Legal requirements are often assessed through scenarios rather than direct definition questions.
Example 5 - You do: Quick retrieval grid
Complete the table from memory, then check your answers against the What You Need To Know page.
| Term | What does it mean? | Why does it matter? |
|---|---|---|
| Low-code | ||
| AI code generator | ||
| Readability | ||
| Maintainability | ||
| Copyright | ||
| Debugger |
Study Tip
Retrieval practice is strongest when you try to answer first without notes, then correct your thinking afterwards.