Practices and principles
Domain 1 - Practices and principles
This domain tests how you think and build: computational thinking, program construction and design. The paper gives you an unfamiliar problem and asks you to break it down, express a solution unambiguously, and read or write code by hand. Python is the usual language; pseudocode is acceptable provided every step is precise.
Computational thinking
Four moves carry most of the marks. Decomposition splits a problem into parts you can solve separately. Abstraction keeps only the detail the solution needs - a student record reduced to the three fields the program uses. Pattern recognition spots repeated structure so one loop or function replaces ten copied blocks. Algorithm design produces an ordered, finite, unambiguous set of steps that terminates for every legal input.
Control structures and functions
Every program is sequence, selection and iteration; name them when asked. Conditions are built from comparisons and the Boolean operators and, or, not - be ready to complete a truth table. Iteration is definite (for, a known number of repeats) or indefinite (while, repeats until a condition changes). Functions name a sub-task: state the parameters and the return value, and keep each function to one job.
Testing
Write inputs, processes and outputs before code. Test with normal, boundary and invalid data. A trace table - one column per variable, one row per iteration - is the standard way to prove a loop behaves.
Worked example
Count the words longer than five characters in a sentence.
Decompose: split into words, measure each, increment a counter when the test passes.
count ← 0
for word in sentence.split():
if len(word) > 5:
count ← count + 1
return count
Boundary check: the brief says longer than five, so five-letter words must not count. In “the quick brown elephant” the lengths are 3, 5, 5, 8, so the answer is 1. Had the brief said “five or more”, the operator becomes ≥ and the answer is 3.
Traps
Writing ≥ for “more than”; forgetting to initialise the counter outside the loop; iterating characters when the question asks for words; recursion with no base case; confusing = with ==; narrating each line instead of explaining the design decision.