---
title: "Top-down approach"
subject: "Software Engineering"
chapter: 3
key: "semester_5/software_engineering:top-down-approach"
source: https://www.bctengineer.com/q/semester_5/software_engineering/top-down-approach
site: BCT Engineering
---

# Top-down approach

Software Engineering · Chapter 3: Architectural design

- Asked in: 2070 Chaitra (old course), 5 marks
- Video: [Top Down Design](https://www.youtube.com/watch?v=yPLoIDnE7G4) — CodeHS
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/software_engineering/top-down-approach
- Whole chapter: https://www.bctengineer.com/md/semester_5/software_engineering/chapter-3

## Question

Define top-down approach in terms of software engineering.

## Short answer

Top-down approach is stepwise refinement: start with the whole system, decompose it into sub-systems and modules until each part is simple enough to implement. It gives a clear overall view and early skeleton, but low-level details are considered late. Top-down integration testing uses stubs.

## Answer

The **top-down approach** is a design (and development) strategy in which the system is first viewed as a whole and then broken down, step by step, into smaller sub-systems and modules until each part is simple enough to be implemented directly. It is also called **stepwise refinement** (Wirth).

#### How it works
1. Start with the **main function** of the system (the top-level module or context diagram).
2. Decompose it into a few major sub-functions.
3. Refine each sub-function into smaller sub-functions.
4. Repeat until every lowest-level module performs one clear task.
5. Define the interfaces between modules at each level, then code the modules.

**Example: payroll system**

```text
                  +----------------+
                  | Payroll system |
                  +----------------+
         +-------------+-------------+
         |             |             |
   +-----------+ +-----------+ +-----------+
   | Read      | | Compute   | | Produce   |
   | employee  | | salary    | | payslips  |
   | data      | |           | | & reports |
   +-----------+ +-----------+ +-----------+
                   |       |
            +----------+ +----------+
            | Compute  | | Compute  |
            | gross    | | tax and  |
            | pay      | | deduct.  |
            +----------+ +----------+
```

In **top-down integration testing**, the same idea is applied to testing: the top module is tested first with **stubs** standing in for lower modules, and the stubs are then replaced by real modules one at a time.

#### Advantages
- Gives a clear overall view of the system from the start, and it matches how requirements are written.
- Errors in the main structure and interfaces are found early.
- Work can be divided among teams by sub-system.
- A working skeleton (with stubs) can be demonstrated early.

#### Disadvantages
- Low-level details (hardware, performance, reusable library code) are considered late and may force redesign.
- Stubs must be written for testing, which takes effort.
- Less reuse of existing components than the **bottom-up approach**, which builds from low-level modules upward.

In practice most projects use a mix: top-down for the architecture and bottom-up for reusable low-level components.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is the top-down approach (stepwise refinement)?
   A. Building low-level modules first and joining them upward
   B. Viewing the whole system first, then breaking it into smaller sub-systems and modules
   C. Coding all modules at once without design
   D. Testing only the lowest modules
   Answer: B. The system is viewed as a whole and broken down step by step until each part is simple enough to implement. (Key point: Definition)

2. In top-down integration testing, what stands in for lower modules not yet written?
   A. Drivers
   B. Stubs
   C. Patches
   D. Mock users
   Answer: B. The top module is tested first with stubs, which are replaced by real modules one at a time. (Key point: Stubs in top-down testing)

3. Which is a disadvantage of the top-down approach?
   A. Errors in main structure are found late
   B. No overall view of the system
   C. Cannot divide work among teams
   D. Low-level details are considered late and may force redesign
   Answer: D. Hardware, performance and reusable library details come late and may force redesign. (Key point: Disadvantage)

4. Compared with bottom-up, top-down gives:
   A. Less reuse of existing components
   B. More reuse of library code
   C. No need for interface definitions
   D. No early skeleton
   Answer: A. Bottom-up builds from low-level reusable modules, so top-down tends to reuse less. (Key point: Top-down vs bottom-up)

## Related in Software Engineering

- [Top-down integration problems; regression testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Atop-down-integration-regression) — Software Engineering, chapter 8
- [Short note: component-based software engineering](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Acbse-note) — Software Engineering, chapter 6
- [Objectives of FTR; cleanroom software engineering](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aftr-cleanroom) — Software Engineering, chapter 9
- [CMMI levels and the top two levels](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Acmmi-levels) — Software Engineering, chapter 9
- [Software errors and their impact on cost](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Asoftware-errors-impact) — Software Engineering, chapter 7, asked 2×
- [Software reliability and reliability models](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Areliability-models) — Software Engineering, chapter 9, asked 2×

## Related in other subjects

- [Top-down view for F = xz + yz'](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Apositive-photoresist-topdown-xz-yzbar) — Embedded System, chapter 8
- [IC manufacturing steps; top-down F = xz + y](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Aic-manufacturing-steps-topdown-xz-y) — Embedded System, chapter 8
- [Organization vs management; scientific approach](https://www.bctengineer.com/question.md?key=semester_7%2Forganization_and_management%3Aorg-vs-management-scientific) — Organization and Management, chapter 2
- [Good programming practice and software selection](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Agood-programming-software-selection) — Instrumentation II, chapter 9, asked 2×
