Conceptual programming

from Wikipedia, the free encyclopedia

Concept-oriented programming is a programming paradigm that is used to convert concepts in the planning phase of a program into the representations of the concepts in machine code . The paradigm of concept-oriented programming was introduced in 2001 by Christophe de Dinechin with the programming language XL .

Pseudo-metrics

Concept-oriented programming makes use of so-called pseudo- metrics to determine the quality of source code. These metrics are referred to as pseudo- metrics because they refer to both the concept part and the code part, with the clear understanding that the concept area cannot be standardized strictly enough to apply a real metric to it. The pseudo-metrics of conceptual programming include:

  • The syntactic noise measures discrepancies between concept and syntax. For example, the semicolon at the end of the command in C can be viewed as syntactic noise, since it has no counterpart in the conceptual space and is therefore actually unnecessary (it is only used by the compiler).
  • The Semantic noise determined discrepancies between the expected statement or conduct of the concept and its actual statement or behavior in the code. For example, the fact that integer types overflow (while real (mathematical) integers don't) is a form of semantic noise.
  • The bandwidth measures how much of the conceptual space is represented by given code. For example, the overloaded addition operator in C has a higher bandwidth than the addinstruction in assembler , because the C operator can also perform additions on floating point numbers, not just on integers.
  • The noise rate shows what proportion of the code is used to represent the actual concepts.

Rule of equivalence, equivalence resolution

The rule of equivalence is fulfilled when the behavior of the code corresponds to the original concept. In many cases this equivalence can dissolve. Integer overflows disrupt the equivalence between the mathematical integer concept (principle) and the computerized attempted approach to this concept.

Many ways of disrupting equivalence have specific names because they are very general and often occur:

  • A domain error (approximately Range Error ) is a situation where the code outside the domain of equivalence (range of equivalency) is executed, which is the area match in the concept and implementation. (see above) An integer overflow is an example of a range error.
  • A concept cast is a rewrite of a particular concept as another concept when the original concept cannot be represented by the normal tools of language. In C, an example of a concept copy is using pointers to output arguments, since C does not actually support output arguments.
  • A priority inversion ( ranking inversion ) is a form syntactic or semantic noise, starting with some forced by the language rules. This type is called inversion of precedence because language has precedence over the concept. In Smalltalk everything is an object, and this rule leads to the undesirable consequence that an expression such as 2+3*5does not obey the usual operator precedence (Smalltalk interprets this as sending the message * to the number that comes out at 2 + 3, which gives a result of 25 instead of 17.)

methodology

To write code, conceptual programming recommends the following steps:

  1. Establishing and defining the relevant concepts in the concept space.
  2. Establish traditional spellings for concepts, or invent new, useful spellings.
  3. Establishing a combination of programming constructs that will allow the concepts to be well represented in the code - This step involves finding a notation as similar as possible to that specified in the previous step.
  4. Write code that preserves the expected behavior and semantics of the important aspects of the original concept as well as possible.

Many programming tools lack representation skills , which is why conceptual programming sometimes requires the use of a preprocessor or metaprogramming techniques.

languages

XL is the only programming language so far that was designed exclusively for concept-oriented programming, but concept-oriented programming can be carried out in almost any language, with varying degrees of success. Lisp and Forth (and derivatives) are examples of pre-existing languages ​​that are well suited for conceptual programming.

Similar projects

There are projects that use similar ideas to generate code at a higher level of abstraction. These include:

See also

Web links