Represent a task as inputs, outputs, constraints and transformations before choosing an algorithm or writing code.
01
Learning objectives
Distinguish a real-world problem from its computational model.
Identify inputs, outputs, processing steps and constraints.
Distinguish well-defined and ill-defined problems.
Use decomposition and abstraction to simplify a complex task.
02
Lesson notes
A computational problem describes a class of instances, the permitted input and the output required. “Calculate the average marks” is incomplete until the input format, number of marks, treatment of missing values and expected output are known. The model intentionally ignores details that do not affect the result.
The input–process–output model is a useful first description. Input is the data supplied, process is the transformation, and output is the result. Constraints define what values are valid, how much data may arrive and what resources or response time are acceptable. A correct program must satisfy the constraints, not just work for one demonstration.
A well-defined problem has clear goals, inputs, constraints and a way to judge a solution. An ill-defined problem may have competing objectives or incomplete information, such as “make the website better”. It needs stakeholder discussion and measurable acceptance criteria before implementation can be evaluated.
Decomposition divides a large task into smaller subproblems with clear interfaces. Abstraction hides irrelevant detail so attention stays on the current decision. For an online order, separate customer validation, inventory checking, payment, dispatch and notification. Each part can be reasoned about and tested independently, then integrated into the full workflow.
03
Worked code examples
Worked example
The example makes the input, transformation and output explicit before discussing how to scale the solution.
marks = [72, 81, 90]
total = sum(marks)
count = len(marks)
average = total / count
print("Input:", marks)
print("Process: total / count")
print("Output:", average)
Output
Input: [72, 81, 90]
Process: total / count
Output: 81.0
04
Key terminology
Computational problem
A problem stated in terms of valid inputs, required outputs and constraints.
Constraint
A condition that limits valid inputs or acceptable solutions.
Decomposition
Breaking a complex task into smaller manageable parts.
Abstraction
Keeping relevant detail while hiding irrelevant complexity.
05
Common misconceptions
Common mistake
Every real-world problem is already precise enough to code.
Correct understanding
Requirements and constraints must be clarified before implementation.
Common mistake
Abstraction means deleting important requirements.
Correct understanding
Abstraction hides irrelevant detail while preserving what the solution must satisfy.
06
Check your understanding
1. Which item defines the allowed range of input values?
2. Breaking an online-order system into payment, inventory and dispatch is: