Before computers can solve a problem, the problem and the ways in which it can be resolved must be understood. Decomposition helps by breaking down complex problems into more manageable parts.
We do many tasks on a daily basis without even thinking about – or decomposing – them, such as brushing our teeth.
Example 1: Brushing our teeth
To decompose the problem of how to brush our teeth, we would need to consider:
which toothbrush to use
how long to brush for
how hard to press on our teeth
what toothpaste to use
Example 2: Solving a crime
It is only normally when we are asked to do a new or more complex task that we start to think about it in detail – to decompositionThe breaking down of a system into smaller parts that are easier to understand, program and maintain. the task.
Imagine that a crime has been committed. Solving a crime can be a very complex problem as there are many things to consider.
For example, a police officer would need to know the answer to a series of smaller problems:
what crime was committed
when the crime was committed
where the crime was committed
what evidence there is
if there were any witnesses
if there have recently been any similar crimes
The complex problem of the committed crime has now been broken down into simpler problems that can be examined individually, in detail.