Lesson map
Lesson 03 published. Map, example, EX007.
flowchart TD
N0["Learning outcomes"]
N1["3.1 Synthetic first"]
N2["3.2 Outputs and exposure"]
N3["3.3 Input checks"]
N4["3.4 Comments that explain why"]
N5["Synthesis"]
N0 --> N1 --> N2 --> N3 --> N4 --> N5
N5 --> EX["Worked example"]
EX --> Q["Exercise EX007"]
Logical drawing
flowchart LR
N0["Learning outcomes"]
N1["3.1 Synthetic first"]
N2["3.2 Outputs and exposure"]
N3["3.3 Input checks"]
N4["3.4 Comments that explain why"]
N5["Synthesis"]
N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> Q["EX007"]
[Learning outcomes]
|
v
[3.1 Synthetic first]
|
v
[3.2 Outputs and exposure]
|
v
[3.3 Input checks]
|
v
[3.4 Comments that explain why]
|
v
[Synthesis]
|
v
[Worked example] --> [Exercise EX007]
Learning outcomes
You will (1) write small programs that process pupil data safely; (2) avoid exposing data in outputs; (3) use synthetic data for practice.
3.1 Synthetic first
Elena's first programs calculate attendance percentages. Dr. Asante insists that all practice uses synthetic pupils generated by a script, never real exports from the trust. Elena writes a generator that produces names, classes and attendance marks with realistic patterns. She learns that synthetic data let her make mistakes safely, share code with classmates and publish examples. The rule protects children and also teaches a habit that professional developers should keep, because real data in practice environments are a frequent source of leaks.
3.2 Outputs and exposure
Her attendance program prints a list of pupils below ninety per cent attendance. Elena realises that if the list were printed and left on a staffroom table, it would reveal sensitive information about families. She changes the program to print counts by class for general use and produce the named list only for the attendance officer, saved to a protected folder. Deciding who sees which output is a programming decision as well as a policy one, and the code can enforce it.
3.3 Input checks
The program reads a spreadsheet. Elena adds checks that reject unexpected columns, such as a health notes column accidentally included in an export. If the column appears, the program stops and explains why. This prevents the program from processing data it does not need. She explains that input checks implement data minimisation at the point where data enter a program, and that failing loudly is better than silently processing sensitive data that should never have been there. Her script rejects unexpected columns.
3.4 Comments that explain why
Elena writes comments that explain privacy decisions, such as why the named list is saved only to a protected folder. A classmate who reviews her code understands the reason and does not change it. Dr. Asante points out that comments explaining why are more valuable than comments explaining what, because the code already shows what it does. Privacy reasoning is easily lost when code changes hands, and short explanations keep it attached to the code that enforces it. Her comments name the purpose.
Worked example
Elena practises with generated pupils, prints class counts for general use and named lists only for the attendance officer, rejects unexpected health columns and documents her reasons in comments.
Synthetic case. Programs and pupils are synthetic.
Errors and limits
Synthetic data may lack real edge cases; add them deliberately.
Exercises
- EX007 — Synthetic practice. Why must practice use synthetic pupils?
Show marking criteria
Rubric: 3 = mistakes and sharing are safe and real data stay protected;; 2 = mentions safety;; 1 = real is fine;; 0 = none. - EX008 — Two outputs. How does Elena change the attendance output?
Show marking criteria
Rubric: 3 = counts by class generally; named list only for the attendance officer;; 2 = one part;; 1 = prints names;; 0 = none. - EX009 — Unexpected column. What does the program do with an unexpected health column?
Show marking criteria
Rubric: 3 = stops and explains;; 2 = warns;; 1 = processes it;; 0 = none.
Synthesis
Chapter 3 programs safely. Chapter 4 develops academic writing.
Continue studying — chapter 03 of 40
← Chapter 02 (draft) · Course chapter index · Chapter 04 (draft) →