Any software developer, working on a new project will need to take time to step back and think before going straight into programming mode and writing their first line of code!
Their first step will be to consider their new system as an abstraction of reality: in other words a computer system is a simplified model of a real life situation.
Let’s consider a game of Pong for instance. A game of Pong is an abstraction of a tennis game at Wimbledon or Rolland Garros.
Abstraction
To define an abstraction, you need to consider which details your system will include and which details will be removed from your system to simplify it.
Pong Game Abstraction | |
Details to keep | Details to remove |
A bouncing ball Two rackets/paddles that can move up and down The net (a line across the screen) A basic scoring system |
The spectators / the stands The referee Light and shadow effects Player and ball movement in 3D Impact of gravity on the ball Spin effects applied to the ball The concept of games and sets The Texture (grass/clay) and line marking of the court Sound effects when the player runs or hits the ball Weather conditions (incl. wind, rain, etc.) |
There are many reasons why we would want to simplify our model:
- A simplified model will be easier to code
- You will be able to complete the project in a shorter timeframe
- The system will not require too much processing power to run smoothly
- The system will be adapted to the input and output devices available
- The system will be easier to use
Once you have defined the scope of your abstraction (the details that your system will include) the next step is to break down this system into many sub-modules that can be tackled one at a time. This is what we call decomposition.
Decomposition
Decomposition consists of breaking down a complex system into smaller sub-systems / modules.
The benefits of decomposition is to:
- Break down a complex system into smaller, more achievable sub-tasks
- Organise your time and resources more effectively, especially when working as a team. Different team members can work on different sub-tasks.
- Identify opportunities where you can re-use existing modules that you may already have implemented within other projects. For instance many system will require a login screen, many games will require a leaderboard. You might already have the code for these sub-modules.
Structure Diagrams
Structure diagrams are often use in computer science to help with the decomposition stage of the project. They help you break down your project into smaller sub-systems. And then for each sub-system you can break these down further into smaller modules or sub-tasks.
For instance, use the drag and drop activity below to complete the structure diagram of the game of Pong:
Structure Diagram – Pong GameOpen in New Window