Programming Paradigms

Programming paradigms1 are styles of building and structuring the programs. They influence directly the way of producing and maintaining software. From 70s to 90s, new programming paradigms were introduced and increasingly more used, for their useful nature.

Imperative

Imperative programming2 is a programming paradigm that describes explicitly the computation as a series of statements, commands or actions that change the state or variables of the program. We can associate the imperative paradigm with imperative expressions of natural languages, but instead of giving commands to person, we give commands as a sequence to the computer.

The core of imperative programming can be associate with the concept of Turing Machine3, which is basically a mathematical abstraction of a set of computable functions. Translated, it means that the usual implementation of almost all computers is imperative.

From 1970s to 1990s, many programming languages that supported imperative programming came out. In 1970, Pascal, developed by Niklaus Wirth, and C, created by Dennis Ritchie at the Bell Laboratories. Another language that was developed in those years, by request of U.S Department of Defence, was Ada.

Declarative

In contrast to the imperative and procedural programming paradigm, there was the declarative paradigm4 that expressed the logic of computation without describing its control flow. A program is declarative if it describes what it does, and not how to do it. Functional5 and logical programming6 are characterized by declarative programming style. An imperative language has to correspond to mathematical logic.

At the beginning of the 1970s, one of the most important declarative languages appeared was the SQL language, which was conceived basically to manipulate data from and to a database or a RDBMS.

In the late 80s and in the early 90s, another important declarative language was invented for structuring webpages, the markup language HTML. This markup language was first conceived for a restrict group of scientist at CERN for sharing documents, but soon the physicist Tim Berners-Lee, its creator, wrote a memo proposing an Internet-based hypertext system.

Structured

Structured programming7 is a style of programming where the clarity and the quality of the software are really important. It does not allow unconditional jumps in the source code, making the programs more well structured. It makes extensive use of functions or procedures, block structures and for and while loops, in contrast to the use of the construct "goto".

This style of programming language was first thought by Böhm and Jacopini8, around the late 60s. They sustained, in their theorem, that any good well designed program or algorithm could simply be written using 3 types of control flows: sequential (normal sequential flow), conditional or selection (if statements) and iteration (loops).

When C came out, in the early 70s, it had facilities to support structured programming, even though it had also constructs for non-structured programming, such as the famous "goto" construct.

Other important characters who gave the major contributions to the evolution of this paradigm were Dijkstra, Robert W. Floyd, Tony Hoare, between many others.

Object-Oriented

Object-oriented or OO9 is a programming style where the main data is represented by objects, which are instances of classes. Classes have attributes (or data fields) and functions or more usually called methods.

Instance of classes, objects, can have their own attributes and functions, unless those attributes and functions are not specifically and explicitly declared respectively class attributes or class methods, which are both share by all instances of that class (static variables and functions) and usually can be used also by other classes or objects, or simply by other functions.

Objects and classes in this paradigm can be smoothly compared with real objects and classes. For example, a Polo, which is an object, is part of the class car, which is part of the abstract class vehicle.

Example of Inheritance

One of the first or probably the first object-oriented language was the Simula 67 programming language, which inspired subsequently other incoming colossal programming languages, such as Smalltalk or C++10. Simula 67 introduced objects, classes, inheritance and subclasses, virtual methods, coroutines and other features.