鶹Լ

Problem solving - EduqasAbstraction

Computers can be used to help solve complex problems using computational thinking. This means that before a problem can be tackled, it must first have been through decomposition and abstraction. This will result in a modular programmed solution with subroutines and clear interfaces.

Part of Computer ScienceSystems analysis

Abstraction

is the process of filtering out - ignoring - the characteristics of problems that are not needed in order to concentrate on those that are needed. It is also the filtering out of specific details. From this, we can create an idea of what is to be solved.

Abstraction allows us to create a general idea of what the problem is and how to solve it. The process instructs us to remove all specific detail and any patterns that will not help us solve our problem. This helps us to form our idea of the problem. This idea is known as a ‘model’.

Consider the problem of creating a program to calculate the area of shapes. The problem could first be decomposed into modules, each of which would be a particular shape, for example rectangle, square and triangle. Abstraction can then be followed for each module.

For example, for the rectangle module the first step would be to notice that all rectangles share general characteristics:

  • a width
  • a height
  • area = width × height

When abstracting, certain details are discarded but others are kept:

  • all rectangles have a width, but for the program design the actual rectangle width is not needed
  • all rectangles have a height, but for the program design the actual rectangle height is not needed
  • area is always width × height

To solve this problem, all the program needs to be able to do is receive a width and a height, then calculate the area from those numbers. The actual numbers are irrelevant - they change with every rectangle - so they are discarded.

A similar abstraction can be carried out for each module, resulting in a program with self-contained and clear .

An example of abstraction is the London Underground map. It details tube and rail lines and the stations that are on them. That is all that is required for a passenger to be able to plan a journey from one station to another. Other details, such as real geographical location, distance between stations, depth underground and number of platforms, are not included as they are irrelevant to journey planning on the Underground.

A section of the London Underground map