Form 4 · Chapter 1

Problem-Solving Strategy

Before writing any program, a programmer must clearly understand the problem and plan a solution in a structured way using the input-process-output model and decomposition.

Understanding the Problem

The first step in problem solving is to understand the problem itself. A programmer must read the problem statement carefully to identify what is required, what data is available and what result must be produced. Without a clear understanding, the solution built may not meet the real requirement.

To understand a problem, ask questions such as: What information is given? What result is wanted? What conditions or constraints exist?

The Input-Process-Output (IPO) Model

Most computing problems can be described using the Input-Process-Output model:

  • Input — the data entered into the system, for example students' marks.
  • Process — the calculation or processing carried out on the input, for example finding the average.
  • Output — the result shown to the user, for example the average mark.

Key idea

The IPO model separates every problem into three clear parts: what goes in (input), what is done (process) and what comes out (output). This makes planning a solution much easier.

Decomposition

Decomposition is the technique of breaking a large, complex problem into several smaller, more manageable sub-problems. Each small part can be solved separately and then combined. This approach makes a problem easier to understand, to share within a team and to test.

Example

To build a student attendance system, the problem can be decomposed into: (1) register student names, (2) record daily attendance, (3) calculate the attendance percentage, and (4) display a report. Each sub-problem is easier to solve than the whole problem at once.

The Problem-Solving Cycle

Problem solving usually follows a repeating cycle: understand the problem, plan a solution (an algorithm), implement it (write the code) and test and evaluate. If the result is unsatisfactory, the programmer returns to an earlier step to improve it.

Remember

Do not rush into writing code. Understand the problem and identify the input, process and output first — this saves time and reduces errors.

Stuck on this topic? A verified JomKelas tutor can walk you through it.

Find a verified tutor