1.4 Principles of Programming

Paradigms

Procedural - Instructions are carried out linearly. E.g. Python, VB, Java, etc.

Declarative - A set of rules or functions which are called upon when an action is carried out. E.g. Spellcheckers

Event Driven - Programs which respond to actions such as "button clicked". E.g. VB

Visual - Where the programmer will manipulate the program visually. E.g. Scratch

Mark-Up - Describes how text, images and other content are displayed on a GUI. E.g. HTML

Object Oriented Programming - Where a base "class" is created and is given attributes and methods. From this template, "Objects" can be created, which inherit some of the attributes, but may have completely different methods.

Levels

Low level - Languages of this type refer to specific memory locations and are highly specialised. They allow the user to interact with components like the CPU and registers directly. Eg. Machine code and assembly language

High level - Allows the use of variables and data structures such as lists, among many other things. These languages are built on the foundations of low level languages, so one process carried out translates to multiple low level instructions. Eg. Python, VB, Java

Generations

1GL - Handles very basic processes at extremely high speeds, as it is read directly by the CPU. There are no compilers or assemblers and the code is written in binary. Eg. Machine code

2GL - This level of code can be read by a programmer, by must be converted to machine code through assembly. Eg. Assembly language

3GL - The most commonly used and basic generation of languages, 3GLs are easy to learn and give the ability for the user to create complex systems. They are much more user friendly, usually offering detailed error messages and online resources and libraries. Eg. VB, Python, Java

4GL - Languages that are designed to be more user friendly and more specialised than 3GLs. They are often created to handle a specific area of computer programming. Eg. Graphical, Mathematical and Fluid representation programs.

BNF

BNF - A standard for explaining the grammar of a programming language.

Eg. <name> ::= <letter>

Eg. <letter> ::= "a"|"b"|"c"|...|"z"

Recursion eg. <number> ::= <digit>|<digit><number>

Syntax diagram

BNF explained in a diagram

Circles for characters and symbols. Eg. "a" or 1

Rectangles for "variables" which link to other diagrams

Recursion is done by an arrow pointing back around

Eg. Username = -> FirstName -> "." -> LastName -> Digit ->

Definitions

Standards - In computer programming, standards are used so that manufacturers don't create devices that are incompatible with each other. Eg. USB (Universal Serial Bus)

Machine Code - Binary code which a computer can interpret and execute.

Assembly code - Works in mnemonics (eg. ADD) and references memory locations, similar to machine code but a bit more user friendly.

Source code - Code written in high level languages, near to English and is much easier to interpret.