Abstract Models in Computational Thinking (OCR A Level Computer Science)
Revision Note
Devising an Abstract Model
How can you Devise an Abstract Model for a variety of situations?
In order to create abstract models, the following questions must be answered carefully:
What is the specific problem to be solved?
Can the problem be broken down into milestones?
What elements will impact the solution for each milestone?
Alternatively, if an element were to be removed, would it impact the solution in any way?
Programming language abstraction
Programming languages are themselves an abstraction of other languages
Machine code, also known as binary, is a first generation language, using 0’s and 1’s to create programs.
This process is time consuming, tedious and error prone even for simple programs
Assembly language, a second generation language, was developed to improve developers ability to create programs. Assembly language uses mnemonics to represent groups of binary digits, for example 1011 might represent the instruction ADD.
The advantage of assembly language was that it was easier, quicker and less error prone to create languages. The underlying implementation of 0’s and 1’s was abstracted away from the developer. They did not need to see how the program was actually run on the hardware
The disadvantage of assembly language is that each processor has its own version, a chip instruction set, that can only run on that particular family of processors. Programs had to be rewritten to run on other instruction set machines
High level languages such as BASIC and FORTRAN were developed in the 1960’s, which became the third generation set of languages. Other languages such as Python, Java, and C are considered third generation
The advantages of third generation languages were that they abstracted long, complicated sequences of instructions into shorter instructions. For example, multiplying a number in assembly language takes many lines of instructions, where as in Python, this takes only one line; A = B*C
High level languages allow developers to ignore how data is stored in memory and the specifics of how instructions are carried out in the processor. Instead this allows them to focus on creating more complex programs much quicker and easier than using assembly language
Abstraction in the context of languages allows developers to focus on solving the problem rather than worrying about the technical details. A comparison would be that a car driver doesn’t necessarily need to know how the engine or mechanics of the car work in order to drive.
Similarly a programmer doesn’t need to know all of the underlying technical complexity to create complex programs
Data abstractions
As with programming language abstraction, data can also be abstracted
Programmers generally do not need to worry how primitive data types, such as integers, strings or booleans are stored and represented in a computer. These implementations are hidden to make creating programs easier
Higher level languages allow programmers to create abstracted data types to represent logical structures such as modelling the queue of a fast food restaurant
Queues are first-in, first-out structures where new people are added to the back and removed from the front once served and usually have a maximum capacity
Data structures such as queues are actually modified arrays, which in turn are collections of variables, which are collections of bytes, which are collections of bits, which are collections of flip-flops
A programmer does not need to worry about the underlying implementation of a queue and how its stored in memory, only that they can add to and remove data from a queue
In this way, powerful analogous structures can be created that closely resemble, and operate similarly to, real life
This makes problems easier to solve and easier to understand and model
Overall, abstraction is about separating what a program does from the implementation or how it does it
You've read 0 of your 5 free revision notes this week
Sign up now. It’s free!
Did this page help you?