2. Top Down Design

If you have a big problem to solve, then a very effective method of working towards a solution is to break it down into smaller, more manageable problems.

This is the idea behind 'top-down design'. Another term used is 'Stepwise refinement'.


A software program is needed to handle the lights in a concert stadium. There are hundreds of lights, all producing complicated sequences and effects (think 'X factor' stage).



Before a single line of code is written, a structure chart is drawn. Something like this:

Top Down Design Example

This shows that the program is to be sub-divided into 'Modules'.

A 'module' is ideally a self-contained block of code. The code within has a clearly defined set of inputs and outputs, this is called an 'interface'. A module ideally should not depend on what another module is doing at the same time. I say 'ideal' because such perfection is often not possible due to practical constraints.

Each module has a specific function to perform. Its actions are controlled by a master program loop. This is like the conductor in an orchestra, making the whole thing work in harmony.

For example the User Interface Module is responsible for allowing the engineer to set up his light sequence in some manner by means of a screen and input device such as a mouse or perhaps a light pen.

The sequence module might be storing and editing light sequences so the engineer only has to press a single button to fire off a complicated planned light sequence.

The control module is concerned with controlling the hardware. It does this by communicating and controlling a number of sub-modules.

These sub-modules are responsible for certain types of light.

And so on.

The overall structure of the program can be quickly explained and understood. Then perhaps the project manager responsible for the job would allocate teams of specialist programmers to plan each module in detail. They would describe the inputs and outputs of each module (its 'interface') and its performance metrics (response time, storage requirements and so on) to allow the test engineers to 'unit test' the module.

An 'unit test' is a set of software tests that confirm the module is performing as designed

Key terms to understand

  • Top down design
  • Stepwise refinement
  • Structure chart
  • Module
  • Interface
  • Performance metrics
  • Unit test


Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Modular programming methods



Copyright © www.teach-ict.com