Concepts and their Use for Modelling Objects and References in Programming Languages

Reading time: 6 minute
...

📝 Original Info

  • Title: Concepts and their Use for Modelling Objects and References in Programming Languages
  • ArXiv ID: 0801.0135
  • Date: 2008-01-03
  • Authors: Researchers from original ArXiv paper

📝 Abstract

In the paper a new programming construct, called concept, is introduced. Concept is pair of two classes: a reference class and an object class. Instances of the reference classes are passed-by-value and are intended to represent objects. Instances of the object class are passed-by-reference. An approach to programming where concepts are used instead of classes is called concept-oriented programming (CoP). In CoP objects are represented and accessed indirectly by means of references. The structure of concepts describes a hierarchical space with a virtual address system. The paper describes this new approach to programming including such mechanisms as reference resolution, complex references, method interception, dual methods, life-cycle management inheritance and polymorphism.

💡 Deep Analysis

Deep Dive into Concepts and their Use for Modelling Objects and References in Programming Languages.

In the paper a new programming construct, called concept, is introduced. Concept is pair of two classes: a reference class and an object class. Instances of the reference classes are passed-by-value and are intended to represent objects. Instances of the object class are passed-by-reference. An approach to programming where concepts are used instead of classes is called concept-oriented programming (CoP). In CoP objects are represented and accessed indirectly by means of references. The structure of concepts describes a hierarchical space with a virtual address system. The paper describes this new approach to programming including such mechanisms as reference resolution, complex references, method interception, dual methods, life-cycle management inheritance and polymorphism.

📄 Full Content

Let us assume that a method is applied to a local variable which stores a reference to an object. The traditional object-oriented approach to programming assumes that we do not need to know what data is actually stored inside this variable in order to have a possibility to access the referenced object. In this case we are completely unaware of the reference format and it is the task of the compiler to provide a mechanism for object access. Why this conventional approach is so convenient? The short answer is that it effectively hides almost all the numerous peculiarities of the object representation and access (ORA) mechanism and provides an illusion of instant access. Indeed, it is very convenient to simply specify a variable name followed by a field or method and then have the illusion that the result is obtained in the next moment of time.

We have so much accustomed to this approach that completely forgot that it is only an illusion and in reality each access requires significant resources in order to be executed. In other words, the software and hardware environment need to implement rather complex functionality which is responsible for object representation and access in order for the programmer to feel comfortable. If we could take a magnifying glass and look inside a reference then we would find that it is not a primitive construct at all. And if we watched closely inside the access procedure then we would learn many interesting facts.

In particular, each access request results in some more or less complex sequence of actions executed at lower levels of the system organization. Interestingly, this procedure spans not only software levels but propagates further to the hardware levels. For example, in order to perform a method call in Java it is necessary to resolve this reference into a memory handle, which in turn needs to be locked and resolved into an address in virtual memory, which further has to be processed in the CPU and mapped into the physical memory possibly by loading the memory page from the swap file. And it is not the end of the story because this procedure continues at the level of micro-circuit of the memory chip and so on till the physical level of system organisation which involves electromagnetic interactions and other physical effects.

So what is the problem and why do we need to bother if the environment is already implemented in such a way that all these complications are hidden? Why do we need to know the format of references and how they are used to really access the represented objects? Shortly, the problem is that frequently in programming we would like to define our own custom reference format which is designed for representing some special class of objects. The available standard references in this case are too universal because they are implemented to serve an average object under average conditions. But if we need something special then the standard ORA mechanism may be too restrictive. Since complex software systems may involve very different types of objects with very different requirements there is a need in custom object representation and access mechanisms which are suitable for serving specific classes of objects. In other words, each concrete class of objects should be managed by the container which knows its specific features and can handle it appropriately. If we had a possibility to describe custom ORA mechanism using custom reference format and custom access procedures then we would be able to build a kind of internal virtual address space within this program. In other words, what is currently done in the hardware memory manager or operating system memory manager could be done in the program itself. These layers would be integral part of the program itself and hence they would serve the specific needs of this program. For example, we could develop a custom internal container with a special life-cycle management strategy or a container for remote objects etc.

One traditional solution of this problem consists in developing such custom containers implementing some ORA mechanism outside the program at the level of the operating system, as a middleware or library. For example, an operating system could provide additional types of object allocation mechanisms like local heap. A middleware could provide means for managing remote objects which are represented by special references and accessed using some dedicated network protocol. Or a runtime environment could provide its own container for managed objects where they are automatically garbage collected. Although these technologies can significantly help in developing complex systems we are still not satisfied with this approach. And the main reason is that all these custom containers provide standard ORA mechanisms which cannot be easily changed from the program. In other words, each new library or middleware for managing objects is simply yet another universal container. In this situation a programmer has to stil

…(Full text truncated)…

📸 Image Gallery

cover.png

Reference

This content is AI-processed based on ArXiv data.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut