Programming paradigm

A programming paradigm is a fundamental style of programming. " The programming, depending on the design of each programming language based on different principles. These are intended to assist the developer in the creation of "good code", in some cases even force a particular approach to solving problems " are automatically realized in the best case.

Programming paradigms differ in their approaches to the representation of static ( such as objects, methods, variables, constants ) and dynamic ( such as assignments, control flow, data flow ) program elements.

Fundamental to the design of programming languages ​​are the paradigms of imperative and declarative programming. In the latter are to be mentioned as important in nature, the paradigms of functional programming and logic programming.

The different paradigms are based on single computer programs not to be understood as complementary or alternative programming styles. Rather, " many programming languages ​​support multiple paradigms at the same time " can.

Nevertheless, programming languages ​​are often - for example, referred to as object-oriented, procedural or declarative language - according to their basic characteristics. The defining features of a paradigm are mainly based on the characteristics of the applied programming languages ​​( such as OOP, declaratively ...), but (for example, structured in part to the individual style that is practiced in programming, modular ).

Often, the " first-class citizens " ( " First Class Citizens" - FCCs ) of a programming language - that is, the forms of data that can be used directly - are detected, which obeys the language paradigm. In Java ( object oriented), for example, are objects FCCs, in LISP is every bit program FCC, in Perl there are strings, arrays, and hashes.

In addition to programming paradigms, there are a number of other criteria for the development of a possible error-free, and maintainable software - such as readability of the program code, no redundancy, modularity, and absence of side effects. This should be followed as far as possible under each paradigm. See also programming style.

  • 2.1 Functional Programming
  • 2.2 Logic Programming
  • 2.3 Constraint

Imperative programming paradigms

In imperative programming " is a program (note: that is, here is the source code) of a sequence of commands that specify the order in which what is to be done by the computer. The name is based on Latin " imperare " ( " order ", " order ").

"Most of [ ... ] programming languages ​​, including OOP languages ​​such as C #, Visual Basic, C and Java support in the first place [ also ] the imperative [ ... ] programming"

Structured Programming

A further imperative languages ​​marked the legendary essay Go To Statement Considered Harmful by Edsger W. Dijkstra in 1968 Therein the waiver, or at least limit, absolute jump instructions ( Goto ) is required.; should instead control structures, such as " if ... then ...", "case ... of ...", " while ... do ...", "repeat ... until ... " are used. As the classic structured programming language Pascal applies.

Procedural programming

The approach to split programs into smaller tasks is called procedural programming. The resulting sub-programs are called procedures. Virtually all current imperative programming languages ​​include the procedural approach.

The development of procedural programming languages ​​and techniques were an essential step between assembly language and high-level languages ​​by allowing abstraction and decomposition algorithms.

Modular programming

Modular programming was the first attempt, the growing size of software projects to master. In the modular programming of the procedural approach is extended by procedures are summarized together with data in logical units. The software is divided into major functional sub-blocks that can be scheduled individually programmed and tested. The resulting sub- programs are called modules. At the end of the items can then be logically linked together and the software is ready for use. The normalized programming thereby describes an attempt to standardize this process. The first strictly modularized programming language was 1978 Modula -2.

Programming with abstract data types

Programming with abstract data types handled data and functions to treat this data as a unit.

Declarative programming paradigms

The idea of ​​a declarative programming is the historically younger approach. In contrast to imperative programming paradigms, in which the As is in the foreground, one wonders in the declarative programming after Is this supposed to be calculated. It is no longer programmed, the approach, but only stated what result is desired. To this end, based declarative paradigms based on mathematical, computer- independent theories.

  • Due to the referential transparency there are no side effects. Programs are thus partially evaluated, thus allowing, for example, the treatment of infinite data structures.
  • Evidence (eg, proof of correctness, proofs of program properties ) are due to basic mathematical fully operable (including lambda calculus ).
  • Architecture independence
  • Partially low acceptance ( one likes to talk about so-called academics languages)

The declarative programming languages ​​include:

  • Functional languages ​​(including Lisp, ML, Miranda, Gofer, Haskell )
  • Logical languages ​​(including prologue )
  • Functional and logical languages ​​(including Babylon, Escher, curry, Oz)
  • Quantity- oriented query languages ​​(including SQL)

Quicksort example: Haskell is a typical declarative programming language. The programmer describes what the program does with a command, so how to deal with what input, the calculation process is of no interest. The calculations are then carried out by manipulating values ​​. Main control structure is recursion, in particular for reasons of efficiency the tail recursion:

Quicksort [ ] = []   quicksort (x: xs ) = quicksort [ n | n < -xs, n = x] Functional Programming

The task and the well-known assumptions are formulated here as a functional expression. The independent Applying function replacement and evaluation on the part of the interpreter or compiler then solve the task. The program can be thought of as mapping of the input to the output.

Logic Programming

The task and its premises are as logical statements (rules) formulated (see functional programming, see above). The interpreter then attempts to derive the desired solution statement. For other rule-based languages ​​such as OPS -5, XSLT or Prolog rules against a set of data on their Instanziierbarkeit be checked. One ( several, all ) is selected from all Regelinstanziierungen and belonging to the rule statements are executed.

Constraint

In constraint programming constraints are defined. It is understood as a natural development of logic programming. Logical and constraint programming are typically used in combination.

Object-oriented programming paradigms

Classes are instantiable modules and primitives in object-oriented programming. Following the object-oriented programming paradigm objects with data and the subsequent working routines are grouped into units. In contrast, the data from the objects -processing routines kept separate in the procedural paradigm. A computer program is implemented as a set of interacting objects.

Object-oriented programming can be combined well with the event-driven programming, eg when programming interactive, graphical user interfaces.

Component-oriented programming paradigms

Using the component-based software development with abstract and generic component models, software components are created with strictly defined interfaces.

Through the reusability of software components of the development effort and the error rate can be reduced and the information security be increased. The complete and strict encapsulation portability of data and programs is further facilitated.

Agent-oriented programming

In the agent-oriented programming, the concept of autonomous agents and planning is important, solves problems independently and in cooperation with other agents.

Aspect-Oriented Programming

In the aspect-oriented programming to the object -oriented notion of class is extended to aspect, thus enabling orthogonal programming.

Generative programming

Generative programming is an umbrella term for the programmatic generation of source code ( see Book: Generative Programming, Krzysztof Czarnecki, W. Ecker iron )

Generic programming

In the generic program attempting to make the algorithms for a plurality of types of data usable.

Subject-Oriented Programming

The subject -oriented programming is an extension of object-oriented programming. You should compensate mainly the weaknesses of object-oriented programming in the development of large applications and the integration of independently developed applications.

Stream -oriented programming

It is assumed that a continuous flow (usually audio or video data) of the (often in real-time ) changes and outputted.

Graph rewriting

In the graph rewrite the data is modeled in the form of graphs and the calculations specified by graph rewriting rules, by the controlled application of a given work graph is transformed piece by piece.

Concatenative programming

Concatenative programming is characterized by the fact that programs are formed by the simple concatenation of (programming ) words. These all operate on the same data structure, which is passed on without the need for a more extensive complex syntax would be necessary. The result is that a natural language syntax like ABC is possible for other languages ​​such as C (B (A ( x ))) should be written. Concatenative programming languages ​​are therefore mostly reasons of implementation also stack-based languages ​​, such as Forth, Joy, Cat, and PostScript. In contrast, applicative programming languages ​​are those which apply functions to arguments. In this category are the most imperative and functional languages ​​.

662311
de