Content Area 1: Problem Solving
Content Area 2: Introduction to Programming
Content Area 3: Emerging Issues & Impact of Digital
Content Area 4: Legislation & Regulatory Requirements

Abstraction

Once a problem has been decomposed into smaller tasks, and any patterns identified, it is useful to look at the problem, identify what is actually required and remove any unnecessary elements. This will help the programmer save time in developing the solution. This process is called Abstraction.

In this lesson we will learn about how to use Abstraction including:

  1. Identify and remove information from a problem
  2. Creating abstraction layers
  3. Defining abstraction layers

1. Remove Information from a problem

Once we know what the problem is, we can then start to take steps to identify:

  • What data is required
  • What information is required
  • What the program needs to do

For example, looking at the Student Information Management System from the previous lesson, we know that the program will need to:

  • Allow a teacher to record student attendance
  • Produce reports for staff on student attendance
  • Produce reports for parents on the attendance of their son or daughter

From this, we can identify the information required will include:

  • attendance data
  • the ability to search by surname, date and subject

At this stage, we can also start to filter out any data or information that is not necessary. If we do not, then there is a real risk that any programmer will attempt to include this information in the programmed solution. This will waste time and money.

One requirement of the SIMS system is that a teacher can look up attendance details about a specific student. To do this, they type the student’s surname, click ‘enter’ and information is displayed.

The information needed will be surname only.

This will give us a list of students with the specified surname, but the information brought back may include their first, middle and last name(s), subject, attendance data and the lesson date and time.

Information not needed is gender, age and date of birth as this is not relevant to the search request.

Further Thought

You are designing a system to allow students to track when homework has been set and when it is due. What data or information is required and what is not necessary?

2. Creating Abstraction Layers

Abstraction means hiding the complexity of something away from the thing that is going to be using it.

For example, when you press the power button on your computer, do you know what is going on?

Of course not – your computer just turns itself on. That’s all you need to know.

The process of powering up your computer and starting the load process of the Operating System into RAM memory from the boot sector has been hidden from you.

Abstraction in computational thinking is a technique where we split individual parts of the program down into imaginary ‘black boxes’ that carry out operations.

We don’t care HOW the operations are carried out, only that they work consistently and accurately.

For example, in our SIMS system, there will be a ‘search for a student’ process that will make use of the Search Abstraction Layer.

The Search Abstraction Layer contains all the functionality to:

  • Connect to a database
  • Search the database
  • Get the results back from the database
  • Close the connection to the database
Figure 3.1 – abstraction of the search process in a student IMS

The ‘Search for a Student’ process does not know that the Search Abstraction Layer opens a connection to a database and gets a list of search results; all it knows is that it gives the black box a surname and gets back some results.

This is Abstraction: the student search functionality is hidden away from the rest of the system.

Further Thought

Think of your two favourite games. Can you think of any abstraction in each one?

3. Defining Abstraction Layers

Once an abstraction layer has been identified, the layer can be described fully by its inputs, outputs, processes, variables and constants. This is called defining the Abstraction Layer.

Consider the student search system, it can be represented using the following terms:

  • Inputs – these are the values entered into the Abstraction Layer – in this case it’s the student’s surname
  • Outputs – the information produced by the Abstraction Layer – in this case it’s a list of students with a matching first, middle and last name(s), subject, attendance data and the lesson date and time.
  • Variables – these are the values that will change between each use of the Abstraction Layer – in this case it’s the surname of a student used for searching.
  • Constants – this will be something that is likely to remain fixed between each use of the Abstraction Layer – for example the name and IP address of the database that contains the student data.
  • Key Processes – these are the functions that the Abstraction Layer will carry out – for example, opening and closing database connections and searching the database for a given student surname.
  • Repeated Processes – these are things that happen multiple times within the Abstraction Layer, for example adding students with matching surnames to the list of students.

Further Thought

Think back to the Homework Planner program, can you define any Abstraction Layers?

Lesson Summary

So, to summarise what we have learned in this lesson:

  • Abstraction is hiding the complexities of one part of a computer program from another.
  • Abstraction is where we identify the information needed to solve a problem.
  • Abstraction is where we filter out unnecessary details at different stages of solving the problem.
  • Abstraction Layers are where we group areas of functionality.
  • We define Abstraction Layers by including variables, constants, key processes, repeated processes, inputs and outputs.
Quizzes