Description and exemplification of top-down design and stepwise refinement
Right I have been asked about this from a few of you. Mostly along the lines of “What is the difference between top-down design and stepwise refinement?”. Well if you look at the title of the post you will see that they go hand in hand and are not mutuality exclusive.
Top-down just means that you start with the most complex problem and break it down as opposed to bottom-up design where individual modules are knitted together to form the final program.
From Scholar Notes
- a problem might be difficult to solve as it stands. So you try to break it down into a set of smaller problems which might be solved more easily. This represents the first step of the process
- you then take the smaller problems, one at a time, and break them down into still smaller problems
- you keep repeating this process of breaking the problems down until all the problems facing you are small enough to handle
This notion of breaking larger, difficult problems down into smaller, easier-to-solve ones is the refinement. Stepwise refinement is sometimes called top-down design, for the obvious reason that you start the process at the top, with the problem as a whole, and work downwards.
So to summarise
Top-down design involves looking at the whole task and breaking it down into smaller, more manageable sub-problems which are easier to solve. These sub-problems can be divided even further into smaller steps. This is called stepwise refinement.
When this is complete an algorithm is produced which is a sequence of instructions that can be used to solve the task.