SLIDE 1 / 10
CSZone.co.uk
OCR H446 · Component 2 · 2.1.1

Thinking Ahead,
Procedurally, Logically
& Concurrently

OCR A Level Computer Science · cszone.co.uk
H446 SpecA Level
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 Ahead

Thinking Ahead

Thinking ahead means identifying what inputs are needed and what outputs are expected before writing code. It involves specifying preconditions (what must be true before a function is called) and postconditions (what will be true after).
Preconditions
Conditions that must be satisfied before a routine can execute correctly. E.g. a binary search requires the list to be sorted. Checking preconditions prevents bugs and reduces the need for error handling inside the routine.
Caching & Reusable Code
Caching stores the results of expensive computations so they don't need to be repeated. Writing reusable code (subroutines, libraries) means solutions can be applied to future problems without rewriting — a key aspect of thinking ahead.
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).
Comparison

Thinking Approaches: Summary

Thinking Ahead
Identify inputs, outputs, preconditions, and opportunities to reuse existing solutions before coding begins
Thinking Procedurally
Break the problem into a sequence of ordered steps; identify subroutines for each step; create a hierarchy of modules
Thinking Logically
Identify all conditions and decisions; reason about boolean expressions and all possible cases including edge cases
Thinking Concurrently
Identify independent sub-tasks that can be solved simultaneously; consider data dependencies and race conditions
Exam Practice
OCR H446 Style · 4 marks
A developer is building a weather forecasting application that downloads data from multiple satellite sources and then runs a complex model to produce a forecast. Explain how concurrent thinking could improve the performance of this application, and identify one limitation of this approach.
[4 marks]
2
Concurrent benefit: The downloads from multiple satellite sources are independent of each other (they don't depend on each other's results). Concurrent thinking allows the developer to download from all sources simultaneously using parallel threads/processes, reducing total download time from the sum of all downloads to the time of the slowest download.
2
Limitation: The forecasting model cannot begin until ALL satellite data has been downloaded (dependency). This sequential portion cannot be parallelised — the overall speedup is limited by this dependency (Amdahl's Law). Additionally, concurrent code is more complex to write and debug, and race conditions may occur if shared data is not properly managed.
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