Decomposition and abstraction
decompositionBreaking down a complex problem into smaller, more manageable sub-problems. involves analysing a complex problem or system and breaking it down into smaller parts that are more manageable and easy to understand. The smaller parts can then be examined and solved, or designed individually, as they are simpler to work with.
If a problem is not decomposed, it is much harder to solve. Dealing with a complex problem is much more difficult than breaking a problem down into subproblems and solving them, one at a time. Smaller problems are easier to understand and can be examined in more detail.
For example, suppose that a crime has been committed. Solving a crime can be a very complex problem as there are many things to consider.
A police officer would need to know the answer to a series of smaller problems:
- what crime was committed
- when the crime was committed
- where the crime was committed
- what evidence there is
- if there were any witnesses
- if there have recently been any similar crimes
The complex problem of the committed crime has now been broken down into simpler problems that can be examined individually, in detail. Once the individual information has been gathered and collated, the police officer may be able to solve the crime.
Question
How might you decompose the complex problem of how to create an app?
The problem might decompose into these simpler problems:
- what kind of app you want to create
- what your app will look like
- who the target audience for your app is
- what your graphics will look like
- what audio you will include
- what software you will use to build your app
- how the user will navigate your app
- how you will test your app
- where you will sell your app
These smaller problems, solved individually, may help you to create an app.
Abstraction
abstractionThe process of separating and filtering out ideas and specific details that are not needed in order to concentrate on those that are needed. is the process of filtering out - essentially 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, an idea of what is to be solved can be created.
Abstraction allows programmers to create a general idea of what the problem is and how to solve it. The process instructs them to remove all specific detail and any patterns that will not help find a solution. An idea of the problem can then be formed. This idea is known as a 鈥榤odel鈥.
Consider the problem of how a program might be required to calculate the area of any rectangle. All rectangles share general characteristics:
- a width
- a height
- a formula to calculate area: 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, the program needs to be able to input a width and a height, then calculate the area from those numbers. The actual numbers are irrelevant - they change with every rectangle - and so are discarded.
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 passengers 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. They are not relevant to journey planning on the Underground.
More guides on this topic
- Algorithms - Edexcel
- Further algorithms - Edexcel
- Truth tables - Edexcel
- Binary and data representation - Edexcel
- Computers - Edexcel
- Programming languages - Edexcel
- Networks - Edexcel
- Network security and cybersecurity - Edexcel
- Encryption - Edexcel
- Environmental, ethical and legal concerns - Edexcel