大象传媒

Decomposition

is breaking a problem down into smaller, more manageable chunks. In programming, this means breaking down an into smaller problems that can be solved on their own.

For example, using the times table problem from the previous page, this could be broken down in the following way:

num 鈫 USERINPUT
FOR number 鈫 1 TO 10
  OUTPUT number * num
ENDFOR
Diagram showing how a program outputting the times table up to ten can be decomposed.

In larger programs, problems are decomposed further until it is easy to identify how each could be written as an individual in the program. This is useful to a development team, for example, as it means that the work can be divided between them. As the problem has been broken down into smaller sections, the subroutines can be reused to solve similar problems.