Programming paradigms

A programming paradigm is the structure and approach of a programming language. Put simply, this is a style or a way of programming, sometimes referred to as a way of thinking about computing and how to organise programming tasks.

Popular programming paradigms include imperative, procedural and Object Orientated Programming (OOP).

Imperative programming

Imperative languages use statements to change the state of the program. A program's state is the current values of its variables at any given moment. Programs written using an imperative language make use of assignment to change the state of their variables.

In the example below, the value 7 is assigned to variable a, the value 14 assigned to variable b, and the sum of variables a and b assigned to variable c. A program designed to output the value of c, and the value of c when the value of variable a is increased by 1 will look like this:

a=7 b=14 c=a + b PRINT C a=a + 1 PRINT C

When run, this program will output: 21 22