Inclusion (concept-oriented programming)

From Wiki
Jump to: navigation, search

Each concept in the concept-oriented programming (COP) has a parent concept specified via inclusion relation. The parent concept is also called base concept or super-concept. Concept inclusion is a generalization of class inheritance in OOP.

Concept inclusion hierarchy is used to describe the space where objects will exist at run-time. Each concept within the inclusion hierarchy produces individual instances (objects and references) which exist independent of other instances. In contrast to OOP, object parts in COP have their own references describing their location in the context of the parent object. Thus each base object may have many extension objects. If inheritance is thought of as 'IS A' relation then inclusion is thought of as 'IS IN' relation.

In the following example concept Button is included in concept Panel:

   concept Panel 
       reference {
           int panelId; 
           ... 
       }
       object {
           int color; 
           ... 
       }
   
   concept Button in Panel 
       reference {
           int buttonId; 
           ... 
       }
       object {
           String text; 
           ... 
       }

If it were inheritance then each button would be a panel, i.e., an instance of concept Button would produce also an instance of concept Panel. Both parts would have one primitive reference for identifying the button which is simultaneously a panel (these parts exist side-by-side in memory).

In COP these two concepts produce individual objects with their own (local) references. Many buttons can exist within one base panel object. These buttons are identified by their references described in the reference class. A complete button identifier consists of two segments: a panel reference and a button reference. Such an identifier is referred to as a complex reference.

When an object is accessed, say, we set a label for the button, the access procedure starts from the base reference and then proceed to its child segments. In other words, the panel will intercept all accesses to its internal objects like buttons. So any object can be also a container playing a role of environment for its child objects (extensions).

See also

External links

Personal tools
Google AdSense