Concept programming: Difference between revisions

Content deleted Content added
m Bot: Fixing double redirect to Christophe de Dinechin
Tag: Redirect target changed
 
(16 intermediate revisions by 13 users not shown)
Line 1:
#REDIRECT [[Christophe de Dinechin]] {{R from merge}}
'''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 [[machine code|code]] space. This approach was introduced in 2001 by [[Christophe de Dinechin]] with the [[XL Programming Language]].
 
== 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, equivalence breakdown ==
The ''rule of equivalence'' is verified when the code behavior matches the original concept. This equivalence may break down in many cases. Integer overflow breaks the equivalence between the mathematical integer concept and the computerized approximation of the concept.
 
Many 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 ==
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 concepts to be represented comfortably in 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 notational abilities, thus concept programming sometimes requires the use of [[preprocessor]]s, [[Domain Specific Language|___domain-specific languages]], or [[metaprogramming]] techniques.
 
== Languages ==
[[XL Programming Language|XL]] is the only programming language known to date to be explicitly created for concept programming, but concept programming can be done in nearly any language, with varying degrees of success. [[Lisp (programming language)|Lisp]] and [[Forth (programming language)|Forth]] (and their derivatives) are examples of pre-existing languages which lend themselves well to concept programming.{{Citation needed|date=August 2010}}
 
==Similar works==
There are projects that exploit similar ideas to create code with higher level of abstraction. Among them are:
* [[Intentional Programming]]
* [[Language-oriented programming]]
* [[Literate programming]]
* [[Model-driven architecture|MDA]]
 
==See also==
* [[Programming paradigm]]s
* [[Automatic programming]]
* [[Artefaktur]] (AAL)
* [[Abstract syntax tree]] (AST)
* [[Language syntax tree]] (LST)
* [[Semantic resolution tree]] (RST)
* [[Interpretation syntax tree]] (IST)
* [[Code generation syntax tree]] (CST)
* [[Domain-specific programming language]]
 
== External links ==
*[http://xlr.sf.net The XL Programming Language on SourceForge]
*[http://xlr.sourceforge.net/Concept%20Programming%20Presentation.pdf A presentation of Concept Programming]
*[http://www.regdeveloper.co.uk/2008/01/16/concept_programming/ An interview about Concept Programming on The Register]
 
{{DEFAULTSORT:Concept Programming}}
[[Category:Programming paradigms]]
 
[[de:Konzeptorientierte Programmierung]]