OCR Computing A-Level Revision

Paradigms (3.6.a, 3.6.b)

Low level programming

Programming in either machine code or assembly language. Low level languages are often described as being "close to the hardware". Low level languages often produce more efficient programs that high level languages, although they are harder to learn.

Procedural Programming

Procedural programming languages separate data and code. Code is usually modularised and a combinations of sequence, selection and iterative constructs. The programmer describes how to solve the problem, by specifying the steps to execute a program and the order they should be carried out.

Object Oriented Programming (3.6.c)

Object oriented programming is where objects combine methods and data.

Data encapsulation - this means that data can only be accessed via methods provided by objects.
Class - acts as a template for an object. Contains shared attributes and methods.
Object - an individual instance of a class.
Derived class - a class with all the features (including attributes and methods) of a superclass and additional features specific to the derived class. This is an example of inheritance.

Declarative Programming (3.6.g)

Declarative programs consist of declarations - statements that specify what properties the results should have. The order of declarations is not important.

The computer is given a goal. For example foo(x) means "find all members of foo". Rules are used to relate facts - for example foobar(x) if foo(x) and bar(x) is a rule. The computer searches its facts and rules for a solution to the goal. Another example of a goal would be foobar(x)?. The computer will search for a member of foo, and will then see if the solution is also a member of bar. If either one of these fails then the computer backtracks, finding another member of foo.

This process is call predicate logic.

Instantiation is giving a statement variable a value - for example set X = tom.