Like many human languages, different programming languages use very different basic ways of thinking to achieve much the same results. These are called paradigms. Sometimes, one paradigm is distinctly superior for a given type of task (e.g. programming artificial intelligence, or creating device drivers) and programmers are typically familiar with several languages so they can employ the most appropriate language to most efficiently achieve a required result.
Paradigm |
Description |
Object-oriented (OOP)
|
Breaks down a programming task into objects with their own data and methods (subroutines).
These objects – data structures consisting of data fields and methods together – include forms, timers, textboxes, radio buttons, command buttons, listboxes etc.
Methods include such things as commandbutton.click, textbox.keydown, picture.drag etc.
Programming techniques may include features such as data abstraction, encapsulation, modularity, polymorphism, and inheritance.
Many major modern programming languages (e.g. Visual Basic, C++) now support OOP.
An important distinction is that while procedural programming uses procedures to operate on data structures, OOP bundles procedures (methods) and structures (objects) together so an object works on its own inbuilt data structure. |
Event-driven
|
the flow of the program is determined by events—i.e., sensor outputs or user actions (mouse clicks, key presses) or messages from other programs or threads. The language natively supports detection of the events and does not rely on the programmer to create code to do so. |
Procedural
|
The focus of procedural programming is to break down a programming task into a collection of variables, data structures, and subroutines (compared to object-oriented programming.
Such modular languages are dominated by procedure calls to subroutines, subprograms, functions which consist of a series of steps to carry out. A procedure may be called at any point by other procedures or even itself. Each procedure can have defined input requirements (parameters) which it receives, and some procedures (functions) return outputs.
With scoping, the variables within a procedure may be defined as private and cannot be seen or modified by other procedures.
Procedural programming languages are also imperative languages, because they make explicit references to the state of the execution environment (e.g. variables or the position of the "turtle" in the Logo programming language.) |
| Imperative |
define sequences of commands for the computer to perform. |
| Declarative |
expresses what needs to be done, without prescribing how to do it in terms of sequences of actions to be taken |
Reflective
|
In which a computer program can observe and modify its own structure and behavior. Since instructions and data are all numbers, a program can be programmed to rewrite itself. (e.g. in assembly code, command 0xC3 may be Jump and 0xCD might be Call. A program may be created to change the instruction between Jump and Call depending on current runtime conditions.
Such self-modifying code can be risky to use! |
Functional
|
Treats computation as the evaluation of mathematical functions, and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state.
Not usually seen in commercial languages out of academic circles. |
Stack-oriented
|
Languages (usually low-level) which rely on using stacks for passing parameters - such as assembly languages, Forth. Stacks are simple (they only support a few basic methods like PUSH and POP and maybe SWAP, ROLL and DROP) but powerful data storage and retrieval structures. |
Concurrent
|
Languages in which programs are designed as collections of interacting computational processes that may be executed in parallel. |
| Array-oriented |
"Generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays." Example: APL.
Um. Yeah. What he said. The basic idea behind array programming is that operations apply at once to an entire set of values, so programmers can deal with big lumps of data at once instead of repetitively looping through and processing individual data items. |
| Agent-oriented |
In contrast to object-oriented programming paradigms where objects have many methods with variable parameters to them, agent-oriented objects typically have just one method, with a single parameter. This parameter is a sort of message that is interpreted by the receiving object, or "agent", in a way specific to that object or class of objects. |
|