Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Online Courses / University Track / Computing Foundations

Module 6 · Lesson 1 · Core

Abstraction and decomposition

Break a task into parts and describe each part by what it does, not how.

  • 55 minutes
  • Serves O6
  • Assumes Module 5

Phase 1: Prepare

Step 1 Warm-up recall

From Module 5: comparing every pair among 4 items needs how many comparisons?

Private: nothing you type here is sent or stored.

Step 2 Learning goal

By the end of this lesson you can:

  • define abstraction and decomposition (Foundation);
  • split a task into parts (Core);
  • describe a part by its inputs and output (Core).

Phase 2: Teach

Step 3 A familiar example

You can drive a car without knowing how the engine works. You use the pedals and the wheel, and the rest is hidden. That hiding is abstraction.

Step 4 Clear explanation

Abstraction means describing something by what it does and hiding how it does it. Decomposition means splitting a large task into smaller parts, each of which can be understood and checked on its own.

ReadpricesAddtotalAddtaxPrintreceipt
Decomposition: a large task is split into small parts that can each be understood, built and tested alone. Invented receipt task.

The figure splits an invented receipt task into four parts: read the prices, add them up, add tax and print the receipt. Each part has clear inputs and a clear output, and the output of one is the input of the next. A good decomposition has parts that do one job each, and that can be described in a sentence without mentioning how they work inside. When a fault appears, you can then test the parts one at a time instead of searching the whole task. The entry on the algorithm shows the same idea applied to a step-by-step method.

Step 5 Worked example (4 marks)

Split the task “produce a monthly attendance report” into parts.

  1. Part 1: collect the daily attendance records. (1 mark)
  2. Part 2: count the days each person attended. (1 mark)
  3. Part 3: lay out the counts as a report. (1 mark)
  4. Each part has one job and its output feeds the next. (1 mark)

Phase 3: Practise

Step 6 Learner practice (instant-marked)

1. Abstraction means:

2. Decomposition means:

3. A good part of a program has:

4. The main benefit of splitting a task is:

Phase 4: Close

Step 7 Recap

  • Abstraction hides how and shows what.
  • Decomposition splits a task into parts.
  • Each part has clear inputs and an output.

Step 8 Exit ticket (ungraded)

Split the task “send a reminder to every late borrower” into three parts.

Private: nothing you type here is sent or stored.

Step 9 Go further (Extension)

Read the entry on the algorithm and find an everyday example of a method built from smaller methods.

Common mistakes

MistakeWhy it fails
Making one part do everythingGive each part one job.
Describing a part by how it worksDescribe it by inputs and output.
Leaving out the order between partsThe output of one part feeds the next.

Limits. Splitting a task well takes judgement; there is often more than one good decomposition.