We are using cookies to give you the best experience on our site. Cookies are files stored in your browser and are used by most websites to help personalise your web experience.
By continuing to use our website without changing the settings, you are agreeing to our use of cookies.

Concept-oriented programming

From The Concept-Oriented Portal
Revision as of 18:27, 15 February 2014 by Savinov (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Concept-oriented programming (COP) is a programming paradigm which uses concepts as the main programming construct instead of classes as defined in OOP. A concept consists of one object class and one reference class. Object class is precisely what is meant by classes in OOP. Its instances, called objects, are passed-by-reference. References in OOP are allocated automatically and cannot be modeled. What is new in COP is the presence of reference classes. Their instances, called references, are passed-by-value. The purpose of references in COP is the same as in OOP: they are intended to indirectly represent and provide access to objects. The difference is that COP references may have arbitrary structure and behavior. Thus concepts can be viewed a means for modelling references.

Variables in a concept-oriented program store custom references with arbitrary structure and behavior defined in the reference classes of concepts. For example, let us consider the following fragment of code:

   Account account = getAccount();
   Person person = account.getOwner(); 
   Address address = person.getAddress(); 

If it were an OOP program then the variables account, person and address would contain primitive references provided by the compiler. In contrast, if it is a COP program then these variables will contain references in the format provided by the concepts Account, Person and Address, respectively. In fact, these objects can reside anywhere in the world because their references have a custom format and access procedures are written by the programmer. Any access on COP references is indirect and can involve rather complex intermediate operations executed behind the scenes.

Let us assume that concept Account used in the above code snippet to declare a type of variables is defined as follows:

   concept Account 
       reference { // Reference class 
           String accountNumber; // Indirect identifier 
       object { // Object class 
           double balance; 

All variables of this concept will store some account number indirectly identifying this object rather than a primitive reference providing direct access. This account number is then passed-by-value to method parameters, stored by-value in object fields and returned by-value from methods. It is a virtual address of the account object and it is not known where this object actually resides. However, the programmer can work with such indirectly represented objects as if they were normal objects as used in OOP, i.e., COP provides the illusion of direct instantaneous access for indirectly represented objects.

Each concept has a parent concept specified using inclusion relation which generalizes class inheritance. One consequence of having concept inclusion is that references get layered structure. Such references consisting of several segments are referred to as complex references. Thus variables in COP contain hierarchical addresses of objects in a virtual address space. Developing the structure of such a space is one of the main concerns in the concept-oriented program design.

See also


  • [1] Savinov, A. "Concepts and Concept-Oriented Programming", Journal of Object Technology, vol. 7, no. 3, March-April 2008, pp. 91-106.
  • [2] Savinov, A. "An Approach to Programming Based on Concepts", Technical Report RT0005, Institute of Mathematics and Computer Science, ASM, 2007.
  • [3] Savinov, A. "Concepts and their Use for Modelling Objects and References in Programming Languages", Technical Report RT0004, Institute of Mathematics and Computer Science, ASM, 2007.
  • [4] Savinov, A. "Concept as a Generalization of Class and Principles of the Concept-Oriented Programming", Computer Science Journal of Moldova 13(3), 292-335, 2005.

External links

Personal tools
Google AdSense