Learning Objectives
By the end of this topic you will be able to:
Explain thinking ahead: preconditions, caching and reusable code
Describe procedural thinking and how it relates to subroutines and structured code
Explain logical thinking and truth tables applied to problem solving
Define concurrent thinking and explain when it improves performance
Thinking Procedurally
Thinking Procedurally
Procedural thinking means decomposing a problem into a sequence of clearly defined steps. Each step is an instruction that can be followed in order to reach a solution. This maps directly to procedural programming: sequences, selection and iteration.
Procedural thinking identifies which steps must happen and in what order. For example, to validate a login: (1) receive username and password; (2) look up username in database; (3) compare hashed passwords; (4) grant or deny access.
In OCR H446, procedural thinking links to modular design — the program is structured as a hierarchy of subroutines, each of which does one well-defined task. This improves readability, testing and maintenance.
Thinking Logically
Thinking Logically
Logical thinking means identifying the conditions (decisions) that determine which path through a program is taken. It involves reasoning about truth values, boolean expressions and the conditions under which different branches execute.
Boolean Logic in Code
Conditions like if x > 0 AND y > 0 require logical thinking. Compound conditions use AND, OR, NOT. Getting these wrong causes logical bugs — the program runs but produces wrong output.
Identifying Cases
Thinking logically means identifying ALL cases a program must handle — including edge cases (empty list, maximum value, null input). Exhaustive logical analysis leads to complete, correct solutions.
Thinking Concurrently
Thinking Concurrently
Concurrent thinking means identifying which parts of a problem can be solved at the same time (in parallel), rather than sequentially. This requires recognising which tasks are independent of each other and which depend on the result of another task.
In a multi-processor/multi-core system, concurrent tasks can run simultaneously, reducing overall execution time. Example: in image processing, different sections of the image can be processed simultaneously by different cores.
Concurrent thinking is not always applicable — tasks with dependencies must be sequential. Incorrectly parallelising dependent tasks causes race conditions and incorrect results. Careful analysis of data dependencies is essential.
Not all problems are parallelisable — the speedup achievable through parallelism is limited by the proportion of the problem that cannot be parallelised (Amdahl's Law, relevant for H446 performance discussions).
Common Mistakes
Don't Lose Marks
!
Confusing thinking concurrently with multitasking — concurrent thinking in OCR is about identifying which sub-problems can be solved at the same time. Students often describe OS multitasking instead of explaining which parts of a specific problem are independent and can therefore be parallelised.
!
Not linking thinking ahead to preconditions and reuse — students often say "plan before you code" which scores 0. Thinking ahead in OCR means specifically identifying preconditions, postconditions, and opportunities to cache results or reuse existing subroutines/libraries.
!
Saying concurrent thinking always improves performance — you must acknowledge the limitation: tasks with dependencies cannot be parallelised; overhead of creating and managing parallel threads can negate benefits for small tasks.
2.1.1b Complete
Well done! ✓
Thinking Ahead, Procedurally, Logically and Concurrently
Return to lesson to continue