1/19
A-Level AQA Computer Science
What is a programming paradigm?
A programming paradigm is a fundamental style of writing computer code, which contains a framework for how data should be organised/designed.
What does ‘Turing complete’ mean?
When a language can solve all problems a computer can.
What is the order of low level languages?
Hardware → Machine Learning → Assembly
What is the difference between ML and assembly?
ML: Binary, closest to what happens on a computer
Assembly: Mnemonics
What do high-level languages involve?
One instruction = Many lines of code
More complex
Similar to human speech
What are the two types of high-level languages?
Imperative
Uses statements to change a program’s state via sequence, selection, and iteration.
Sub-divided into procedural (built on subroutines) and object-oriented (more modular)
Declarative:
Focuses on what the program should achieve.
What are the characteristics of OOP and procedural programing?
Procedural:
Seq, selection, iteration
Stored in variables
Subroutines
Expressed in procedure calls
OOP:
Seq, selec, iteration, inheritance, encapsulation, etc…
Stored in attributes
Expressed in classes, methods, and instances
Based on purpose, not what it holds
What is problem decomposition?
Breaking a larger problem into smaller problems to produce a hierarchy chart.
Each smaller module should become a subroutine.
Advantages of problem decomposition/hierarchy charts:
Understandable: clear purpose
Reduces bugs and errors
Maintainable: one change doesnt change all
Collaboration
Portabiltiy
Reusability
Definition of OOP
An imperative programming paradigm that involves the capturing of information and code into objects.
They are responsible for their own data and the actions performed upon it.
Class versus object?
The class is the blueprint, which is adapted with specific attributes to become an object.
Example: Class = car, object = Mercedes
What is instantiation?
The process of creating an object from a class template.
What is inheritance?
When code is re-used from one class to another without affecting the original attributes.
Superclass vs subclass?
Superclass: The original attributes
Subclass: The extended attributes
What is encapsulation and why is it done?
The process of bundling data and methods in order to restrict access to it.
This is done to:
provide privacy
hide internal complexity
restrict altering of the object from elsewhere
Static vs dynamic polymorphism?
Static: Allows methods in the same class to have the same name, as long as they have different parameters.
Parameters can be different by amount, type, and colour
Dynamic: Allows methods in the same class to have the same name AND same parameters.
Provides different functionality depending on whether they’re implemented by the superclass or subclass.
Two types of association and their symbols.
Aggregation (outlined diamond) and composition (solid diamond)
What is aggregation?
A weak type of association, where a class is a ‘container’ of other classes.
Contained classes hold little dependency
Still exist if the container is destroyed.
Example: Head teacher and teacher
What is composition?
A stronger type of association, where a class is a ‘container’ of other classes.
There is high dependency on the container
If it is destroyed, so are the contained classes.
Example: Building and a room
What are the three OOP design principles?
Favour composition over inheritance (flexibility)
Encapsulate what varies; methods should be subdivided as much as possible into potential subroutines.
Program to an interface not implementation. The programmer should focus on the code’s purpose, and not how it works.