Free Hosting Online for WorkStations

< Previous | Contents | Next >

26 – Top-Down Design‌


As programs get larger and more complex, they become more difficult to design, code and maintain. As with any large project, it is often a good idea to break large, complex tasks into a series of small, simple tasks. Let’s imagine that we are trying to describe a common, everyday task, going to the market to buy food, to a person from Mars. We might describe the overall process as the following series of steps:

1. Get in car.

2. Drive to market.

3. Park car.

4. Enter market.

5. Purchase food.

6. Return to car.

7. Drive home.

8. Park car.

9. Enter house.

However, a person from Mars is likely to need more detail. We could further break down the subtask “Park car” into this series of steps:

1. Find parking space.

2. Drive car into space.

3. Turn off motor.

4. Set parking brake.

5. Exit car.

6. Lock car.

The “Turn off motor” subtask could further be broken down into steps including “Turn off ignition,” “Remove ignition key,” and so on, until every step of the entire process of going to the market has been fully defined.

This process of identifying the top-level steps and developing increasingly detailed views of those steps is called top-down design. This technique allows us to break large complex tasks into many small, simple tasks. Top-down design is a common method of designing

26 – Top-Down Design


programs and one that is well suited to shell programming in particular.

In this chapter, we will use top-down design to further develop our report-generator script.


 

Top OS Cloud Computing at OnWorks: