Decomposition
Decomposition
• This is the act of breaking down a large problem into smaller, clear, manageable and
understandable sub-parts. Sub-parts can be divided until they are easily solvable and
cannot be broken down any further. An example of decomposition could be getting
ready in the morning to go to school
o Step 1: Wake up
o Step 2: Get breakfast
o Step 3: Brush teeth
o Step 4: Put clothes on
o Step 5: Make sure the bag and school supplies are ready
o Step 6: Find transport to school e.g. walk, bus, car, bike, etc
• These steps could be further subdivided, for example, “Step 2: Get breakfast” would
entail:
o Step 2.1 Get a bowl
o Step 2.2 Get cereal
o Step 2.3 Get milk
o Step 2.4 Get a spoon
o Step 2.5 Put cereal in a bowl
o And so on…
• Once the requirements document has been created, developers need to design the
structure and algorithms to solve the problem:
o Structure charts are created to show the breakdown of tasks in a hierarchy
o Flowcharts may be created to visually show how tasks should be carried out
o Pseudocode is created, sometimes from flowcharts, to allow programmers to
easily translate task instructions into programming code
• The design of a solution identifies what tasks need completing, how to complete the
tasks and how each task works together with other tasks
Decomposing a system
• To create an overall system and solve a problem, it must first be broken down into
subsystems that are easier to solve and create. The act of breaking down the problem
is known as stepwise refinement
• Decomposing the problem this way creates smaller, more manageable and more easily
understandable sub-parts
• Each sub-system can be assigned to a developer or group of developers who
create subroutines from these sub-systems. Each sub-system can then be created at the
same time, reducing development and testing time, especially on large projects
• Decomposing the system using stepwise refinement requires developers to think about
four key areas:
o Inputs: data entered into the system
o Processes: subroutines and algorithms that turn inputs and stored data into
outputs
o Outputs: data that is produced by the system, such as information on a screen
or printed information
o Storage: data that is stored on a physical device, such as on a hard drive
Structure Diagrams
• Structure diagrams show hierarchical top-down design in a visual form. Each problem
is divided into sub-problems and each sub-problem divided into further sub-problems.
At each level the problem is broken down into more detailed tasks that can be
implemented using a single subroutine