#REDIRECT [[Christophe de Dinechin]] {{R from merge}}
{{distinguish|Concept-oriented programming}}
'''Concept programming''' is a [[programming paradigm]] focusing on how ''concepts'', that live in the programmer's head, translate into ''representations'' that are found in the [[code space]].
== Pseudo-Metrics ==
Concept programming uses ''pseudo-metrics'' to evaluate the quality of code. They are called pseudo-metrics because they relate the concept space and the code space, with a clear understanding that the concept space cannot be formalized strictly enough for a real metric to be defined. Concept programming pseudo-metrics include:
* ''[[Syntactic noise]]'' measures discrepancies between the concept and the syntax used to represent it. For instance, the semi-colon at the end of statements in [[C programming language|C]] can be considered as syntactic noise, because it has no equivalent in the concept space.
* ''[[Semantic noise]]'' measures discrepancies between the expected meaning or behavior of the concept and its actual meaning or behavior in the code. For instance, the fact that integer data types overflow (when mathematical integers do not) is a form of semantic noise.
* ''Bandwidth'' measures how much of the concept space a given code construct can represent. For instance, the overloaded addition operator in C has higher bandwidth than the <code>Add</code> instruction in assembly language, because the C operator can represent addition on floating-point numbers and not just integer numbers.
* ''Signal/noise ratio'' measures what fraction of the [[code space]] is used for representing actual concepts, as opposed to implementation information.
== Rule of equivalence, and equivalence breakdown ==
The ''rule of equivalence'' is verified when the code behavior matches the original concept. This equivalence may break down in a number of cases. Integer overflow breaks the equivalence between the mathematical integer concept and the computerized approximation of the concept.
A number of ways to break the equivalence have been given specific names, because they are very common:
* A ''___domain error'' is a condition where code executes outside of the ''___domain of equivalence'', which is the ___domain where the concept and the implementation match. An integer overflow is an example of ___domain error.
* A ''concept cast'' is a rewrite of a concept as a different concept because the original concept cannot be represented by the tools. In C, using pointers for output arguments because C doesn't support output arguments explicitly is an example of concept cast.
* A ''priority inversion'' is a form of syntactic or semantic noise introduced by some language-enforced general rule. It is called a priority inversion because the language takes precedence over the concept. In [[Smalltalk]], everything is an object, and that rule leads to the undesirable consequence that an expression like 2+3*5 doesn't obey the usual [[order of operations]] (Smalltalk interprets this as sending the message * to the number resulting from 2+3, which yields result 25 instead of 17).
== Methodology ==
In order to write code, concept programming recommends the following steps:
# Identify and define the relevant concepts in the concept space.
# Identify traditional notations for the concepts, or invent usable notations.
# Identify a combination of programming constructs that allows the concept to be represented comfortably in the code - That includes finding a code notation that matches the notation identified in the previous step as closely as possible.
# Write code that preserves as much as possible the expected behavior and semantics of the relevant aspects of the original concept.
Many programming tools often lack in terms of notational capabilities, so concept programming sometimes requires the use of [[preprocessor]]s, [[Domain Specific Language|___domain-specific languages]], or [[metaprogramming]] techniques.
== Concept-oriented languages ==
[[XL Programming Language|XL]] is the only known concept-oriented language known to date.
== External links ==
*[http://xlr.sf.net The XL Programming Language on SourceForge]
[[Category:Programming paradigms]]
|