Concept programming
Encyclopedia
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. This approach was introduced in 2001 by Christophe de Dinechin with the XL Programming Language
.
Many ways to break the equivalence have been given specific names, because they are very common:
Many programming tools often lack in notational abilities, thus concept programming sometimes requires the use of preprocessor
s, domain-specific languages, or metaprogramming
techniques.
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 and Forth (and their derivatives) are examples of pre-existing languages which lend themselves well to concept programming.
Programming paradigm
A programming paradigm is a fundamental style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program and the steps that compose a computation A programming paradigm is a fundamental style of computer programming. (Compare with a...
focusing on how concepts, that live in the programmer's head, translate into representations that are found in the code
Machine code
Machine code or machine language is a system of impartible instructions executed directly by a computer's central processing unit. Each instruction performs a very specific task, typically either an operation on a unit of data Machine code or machine language is a system of impartible instructions...
space. This approach was introduced in 2001 by Christophe de Dinechin with the XL Programming Language
XL Programming Language
XL stands for eXtensible Language. It is a computer programming language designed to support concept programming.XL features programmer-reconfigurable syntax and semantics. Compiler plug-ins can be used to add new features to the language. A base set of plug-ins implements a relatively standard...
.
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 CC (programming language)C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
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
Add
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 inversionPriority inversionIn computer science, priority inversion is a problematic scenario in scheduling when a higher priority task is indirectly preempted by a lower priority task effectively "inverting" the relative priorities of the two tasks....
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 SmalltalkSmalltalkSmalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis." It was designed and created in part for educational use, more so for constructionist...
, 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 operationsOrder of operationsIn mathematics and computer programming, the order of operations is a rule used to clarify unambiguously which procedures should be performed first in a given mathematical expression....
(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
Preprocessor
In computer science, a preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers...
s, domain-specific languages, or metaprogramming
Metaprogramming
Metaprogramming is the writing of computer programs that write or manipulate other programs as their data, or that do part of the work at compile time that would otherwise be done at runtime...
techniques.
Languages
XLXL Programming Language
XL stands for eXtensible Language. It is a computer programming language designed to support concept programming.XL features programmer-reconfigurable syntax and semantics. Compiler plug-ins can be used to add new features to the language. A base set of plug-ins implements a relatively standard...
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 and Forth (and their derivatives) are examples of pre-existing languages which lend themselves well to concept programming.
Similar works
There are projects that exploit similar ideas to create code with higher level of abstraction. Among them are:- Intentional ProgrammingIntentional ProgrammingIn computer programming, intentional programming is a collection of concepts which enable software source code to reflect the precise information, called intention, which programmers had in mind when conceiving their work...
- Language-oriented programmingLanguage-oriented programmingLanguage oriented programming is a style of computer programming in which, rather than solving problems in general-purpose programming languages, the programmer creates one or more domain-specific languages for the problem first, and solves the problem in those languages...
- Literate programmingLiterate programmingLiterate programming is an approach to programming introduced by Donald Knuth as an alternative to the structured programming paradigm of the 1970s....
- MDAModel-driven architectureModel-driven architecture is a software design approach for the development of software systems. It provides a set of guidelines for the structuring of specifications, which are expressed as models. Model-driven architecture is a kind of domain engineering, and supports model-driven engineering of...
See also
- Programming paradigmProgramming paradigmA programming paradigm is a fundamental style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program and the steps that compose a computation A programming paradigm is a fundamental style of computer programming. (Compare with a...
s - Automatic programmingAutomatic programmingIn computer science, the term automatic programming identifies a type of computer programming in which some mechanism generates a computer program to allow human programmers to write the code at a higher abstraction level....
- ArtefakturArtefakturArtefaktur Component Development Kit is a platform-independent library for generating distributed server-based components and applications. Services are provided by a C++ framework....
(AAL) - Abstract syntax treeAbstract syntax treeIn computer science, an abstract syntax tree , or just syntax tree, is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code. The syntax is 'abstract' in the sense that it...
(AST) - Language syntax tree (LST)
- Semantic resolution treeSemantic resolution treeA semantic resolution tree is a tree used for the definition of the semantics of a programming language....
(RST) - Interpretation syntax tree (IST)
- Code generation syntax tree (CST)
- Domain-specific programming languageDomain-specific programming languageIn software development and domain engineering, a domain-specific language is a programming language or specification language dedicated to a particular problem domain, a particular problem representation technique, and/or a particular solution technique...