What is Computational Thinking?

Computational thinking is the process of solving problems in a structured way that can be implemented using algorithms. It involves two key steps:

  1. Formulating the problem – Expressing the problem in a way that allows it to be solved algorithmically.
  2. Constructing an algorithm – Designing a step-by-step solution to the problem.

A good algorithm is both correct (solves the problem) and efficient (performs well). Computational thinkers validate their solutions using logical reasoning, test data, and user feedback.

Computational thinking involves:

Abstraction

Definition: Abstraction is the process of removing unnecessary details to create a simplified representation of information.

In programming, abstraction separates what a program unit does from how it does it.

Abstraction in High-Level Languages

High-level languages use abstraction to simplify programming:

  1. First-generation – Machine code (manual input of 1s and 0s).
  2. Second-generation – Assembly language (mnemonic codes for instructions, hardware-specific).
  3. Third-generation – High-level languages (e.g., BASIC, FORTRAN) introduced statements like x = a + 5, hiding memory management details.

Each step in this evolution is an example of abstraction, making it easier to write complex programs.

Abstraction by Generalisation

Definition: Grouping by common characteristics to create a hierarchical "is a kind of" relationship (linked to graph theory).

Example in Object-Oriented Programming (OOP):

Data Abstraction

The details of how data is stored or represented remain hidden to the user.

Example: When using integers or real numbers in a program, the programmer does not need to know how they are stored in memory or often where they are stored within memory.

In high-level languages, Abstract Data Types (ADTs) like queues, stacks, and trees.

Computational Problems

A computational problem can be represented as diagrams:

Computational Thinking Diagram

Input → Algorithm → Output

A clear statement of the inputs and outputs of a problem are a necessary first step in creating a solution.

Specifying Preconditions

To prevent errors, a function should either:

Advantages of Specifying Preconditions

The Need for Reusable Program Components

Reusable code improves efficiency, maintainability, and scalability by allowing tested components to be applied in multiple programs.