Decomposition

Decomposition means breaking down a problem into sections which are easier to manage – this is something done by every computer scientist.

How do we decompose a problem?

1.Look for key tasks and functions.

2.For each key task or function: Can you solve it in one go? If not, break it down in to sub-tasks or functions.

3.Continue doing this until every task is as broken down as it needs to be in order to be manageable.

Although these methods are excellent for developing computer programs and inherent in good design work, they can also be used in offline tasks, such as:

  • Planning books or papers – break down to chapters, sections, paragraphs.
  • Building a house – break down to frame, cladding, roof, interior, and further to electrics, plumbing, fittings, décor.

Practice Ideas

1. Think about a recent experiment you did in science – given that your teacher probably gave you an overview, take that overview and decompose it.

2. Create a game of rock, paper, scissors. Decompose the problem to manageable steps:

(a) Create a diagram.

(b) Create a numbered list of steps.

3. Problem: Your teacher has set up a board game club after school, but all the games they bought from eBay have come without instructions! You need to write some.

Patterns


Abstraction

Abstraction means taking away the unneeded information to leave just what is needed to solve the problem.

Practice Tasks

1. Create an abstract representation of part of the school layout.

2. Copy this diagram. Place your finger on point 1. You can move to any adjacent point. Find a series of moves so your finger moves to every point exactly once, returning to where it started.

3. Place a chess Knight on square 1. By making only ‘Knight’ moves as in chess, find a series of moves so that the Knight visits every square exactly once before returning to square 1.

This activity is based on ‘Knight’s Tour’, made available under a Creative Commons licence (Attribution NonCommercial ShareAlike - "CC BY-NC-SA“) on http://teachinglondoncomputing.org . This license lets others remix, tweak, and build upon a work non-commercially, as long as they credit the original author and license their new creations under the identical terms. Others can download and redistribute this work just like the by-nc-nd license, but they can also translate, make remixes, and produce new stories based on the work. All new work based on the original will carry the same license, so any derivatives will also be non-commercial in nature.

Algorithms (Pseudocode and Flowcharts)

Flowchart Exercises