Skip to main content

About this free course

Download this course

Share this free course

Introduction to computational thinking
Introduction to computational thinking

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

2 Computational thinking and abstraction

In the next activity you will see Wing explain how computational thinking involves the process of abstraction.

Activity 3 Abstraction

Timing: 8 minutes

Watch the video and then complete this activity.

Download this video clip.Video player: Abstraction
Copy this transcript to the clipboard
Print this transcript
Show transcript|Hide transcript
Abstraction
Interactive feature not available in single page view (see it in standard view).

Wing talks about abstractions as a means of ignoring detail that is not of interest. Consider the following description of an algorithm for searching a paper and ink dictionary.

Given:

  • i.a dictionary
  • ii.a headword W which appears in the dictionary

to find the definition of W:

  • Begin the search with an entry that appears (roughly) in the middle of the dictionary. Then there are three possibilities:
    1. The current entry’s headword is W. In this case, the definition of W is the definition of the current entry.
    2. W appears alphabetically before the current entry’s headword. In this case, the entry with headword W must appear in the first half of the dictionary. Look for the word W, following the same approach, in the first half of the dictionary.
    3. W appears alphabetically after the current entry’s headword. In this case, the entry with headword W must appear in the second half of the dictionary. Look for the word W, following the same approach, in the second half of the dictionary.

This is an informal description of an algorithm, but the steps are sufficiently precise that a human should have no problem following them. This algorithm depends crucially on the fact that the words in a dictionary are alphabetically ordered. It also, however, ignores some of the details of paper and ink dictionaries. Can you list of few of these?

Described image
Figure 4 A dictionary

Discussion

Details of a paper and ink dictionary that come to mind include: the size and thickness of its pages, the colour of its cover and the size of the printed font. None of these played a role in the algorithm that is described above. Perhaps the most salient abstraction relates to the fact that paper and ink dictionaries are made of pages. They are not simply a list of words and definitions. Rather, the words are distributed across the pages of the dictionary. The algorithm doesn’t take into account the distribution of the words in a dictionary across pages: for example it would work equally well with a dictionary printed on a single, enormously long paper scroll.

Wing’s discussion of abstraction draws on a wide variety of concepts. You have come across phrases such as ‘ignoring’ and ‘hiding information’, ‘levels’ and ‘layers’, ‘models’ and ‘implementation’. It has been left somewhat in the air how these all hang together. So next, we will make the relations between them explicit. To do so, we will distinguish between two kinds of abstraction:

  • abstraction as modelling
  • abstraction as encapsulation.

Although Wing deals in great detail with the idea of abstraction as modelling, she only hints at the concept of abstraction as encapsulation. Both are, however, at play in computing. Distinguishing between them will give you a better understanding of the remainder of Wing’s story.