← CSHub / H446 Component 02 / 2.1

Elements of Computational Thinking

OCR H446 A-Level Computer Science — Component 02, Section 2.1

A-Level
A

Abstraction

Abstraction means removing unnecessary detail to focus on only the features that matter for solving a problem. It reduces complexity by hiding implementation specifics.

Representational Abstraction

Remove irrelevant detail from a representation. A road network map removes buildings, street furniture and surface type — it keeps only roads, junctions, and distances.

Abstraction by Generalisation

Group problems with common features into a single reusable solution. A sorting algorithm abstracted from a specific data type works on any comparable data. A class in OOP abstracts a real-world entity.

Exam precision — what abstraction is NOT:

  • It is not simply "making things simpler" — it is a principled removal of detail
  • The detail removed must be irrelevant to the purpose of the model
  • An abstraction that removes the wrong detail is a bad abstraction
D

Decomposition

Breaking a complex problem into smaller, independent sub-problems that are individually solvable. Each sub-problem can be solved, tested, and maintained separately.

Top-Down Design

Start with the overall problem and successively break it into smaller sub-tasks

Structure Charts

Visual representation of decomposed modules and their relationships

Independent Modules

Sub-problems can be assigned to different developers and solved in parallel

# Decomposed: Student Grade Tracker

Student Grade Tracker

├── Input Module

│ ├── Read student names

│ └── Read grades

├── Processing Module

│ ├── Calculate average

│ └── Determine grade boundary

└── Output Module

├── Display report

└── Export to file

TA

Thinking Ahead

Anticipating what will be needed before it is required. This includes defining interfaces early and pre-computing results that are likely to be needed.

Preconditions & Interfaces

Define what inputs a module expects and what it outputs before writing the implementation. Teams can then work independently against the agreed interface.

# Interface defined first:
def calculate_grade(score: int, max_score: int) -> str:
...

Caching & Prefetching

  • Caching: Store the result of an expensive computation so it can be returned immediately if the same input is seen again (e.g. memoisation in dynamic programming, DNS cache, CDN edge cache)
  • Prefetching: Load data into faster memory before it is explicitly requested — e.g. CPU prefetches next instructions, a browser prefetches linked pages
TC

Thinking Concurrently

Identifying which sub-tasks can execute simultaneously to improve performance. Not all problems are parallelisable.

✓ Good candidates for concurrency

  • Rendering independent video frames (GPU)
  • Querying multiple databases simultaneously
  • Processing independent pixels in image filters
  • Running separate test suites

✗ Poor candidates — data dependencies

  • Running total / cumulative sum (each step depends on last)
  • Sequential sorting passes
  • Shared mutable state → race conditions
  • Tasks that must complete in strict order

Race Condition

When two threads read and write shared data simultaneously, the final value depends on which thread finishes last — an unpredictable and dangerous outcome. Prevented by mutex locks or semaphores.

TP

Thinking Procedurally

Breaking a solution into a step-by-step logical sequence of instructions that a computer can follow. Enables structured design and clear tracing.

  • Each step must be unambiguous
  • Order of steps matters
  • Subroutines encapsulate sequences that are reused
  • Foundation of procedural programming languages
TL

Thinking Logically

Identifying conditions and decision points in a solution. Determining what decisions need to be made and what information is required to make them.

  • Boolean conditions and branching
  • Loop termination conditions
  • Precondition validation
  • Directly feeds into algorithm design and Big O analysis

Link to Algorithm Evaluation

Computational thinking — especially decomposition and thinking concurrently — directly informs how we evaluate algorithmic efficiency using Big O notation. A well-decomposed algorithm is easier to analyse. Concurrent sub-tasks can reduce overall time complexity from O(n) to O(n/p) where p is the number of processors.

Interactive: Computational Thinking Classifier

For each scenario, select the primary computational thinking element being applied. Instant feedback provided.

Interactive: Decomposition Tree Builder

Drag each sub-task into the correct level of the decomposition tree for "Build a Student Grade Tracker". Then click Check to see how well your decomposition matches the model answer.

Available tasks — drag into the tree:

Student Grade Tracker
Input Module

Drop sub-tasks here

Processing Module

Drop sub-tasks here

Output Module

Drop sub-tasks here