Scalable Multiple Representation and Dynamic Classification by Multiple Specialization of Objects in OO-Prolog
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Computer Trends and Technology Volume 68 Issue 11, 24-42, November 2020 ISSN: 2231 – 2803 /doi:10.14445/22312803/IJCTT-V68I11P104 © 2020 Seventh Sense Research Group® Scalable multiple representation and dynamic classification by multiple specialization of objects in OO-Prolog Macaire Ngomo#1 # CM IT CONSEIL – Engineering and Innovation Department – 32 rue Milford Haven 10100 Romilly Sur Seine (France) Abstract - This study takes place within the framework of the The inheritance management model of the OO-Prolog representation of knowledge by objects and within the language is based on the non-determinism of logic framework of our work on the marriage of logic and objects. programming, on explicit naming, and on the concept of full On the one hand, object-oriented programming has proved attribute naming, which allows conflicts to be resolved to be appropriate for constructing complex software before they arise. The OO-Prolog language adopts a dynamic systems. On the other hand, logic programming is inheritance for both attributes and methods. This is a distinguished by its declarative nature, integrated inference, difference with classical models such as the ObjVLisp model and well-defined semantic capabilities. In particular, from which it was inspired. Let us recall that ObjVLisp inheritance is a refinement mechanism whose mode of makes a static inheritance of the instance variables, which application leaves several design choices. In the context of results in the flattening of the inheritance graph regarding the this marriage, we describe the semantics of multiple state of an object. The result is that an object in ObjVLisp is inheritances in a non-deterministic approach, the conceptual a vector of instance variables where all inheritance choices of integration of multiple inheritances made for the information has disappeared. design of the OO-Prolog language (an object-oriented extension of the Prolog language respecting logical II. THE OBJECT PARADIGM AND ITS semantics) as well as its application to multiple evolutionary DIMENSIONS representations that support classificatory reasoning and to The paradigm of object-based programming, born with dynamic classification by multiple specifications of logical Smalltalk [37] at the end of the 1970s, has become very objects. popular: object-based languages, object-based representations in artificial intelligence, object databases, Keywords — Object-oriented logic programming, object- object-based design in software engineering, etc. The oriented representation, multiple inheritances, multi-point of paradigm of object-based programming is now being used view, classificatory reasoning. in many different fields. It gives great power of expression, ease of maintenance, and reusability superior to other I. INTRODUCTION paradigms: imperative (example with C), functional Inheritance is a refinement mechanism whose mode of (example with LISP [89] [90] [90]) or logical (example application leaves a number of design choices. In this article, with PROLOG [88] [91] [90]), etc. However, it requires a we describe the semantics of inheritance [11] [12] in a non- greater abstraction capacity than imperative or functional deterministic approach as well as the conceptual choices of programming to choose the "objects" to be reified and integration of monotonous multiple inheritances made for the define inheritance and composition between classes in a design of the OO-Prolog language (an object-oriented meaningful and coherent way. extension of the Prolog language respecting logical The main dimensions of the object paradigm which are semantics) [72] [73] [74] [75] [76] [77] [78] [79] as well as classification, inheritance which introduces the notions of its application to the dynamic classification by multiple generalization and specialization, encapsulation and specializations of logical objects. Our work concerns the polymorphism (generic functions), were brought together for multiple and evolutionary representation of objects that the first time in Smalltalk 76 [37], although the ideas of class supports reasoning by classification [68] [21] [24] [17] [14] and instance, and inheritance had matured with SIMULA [30] [52] [53] [54] [55] [57] [NEBEL 90] [QUI93] [58] [35]. [23]. Classes were seen as objects, created by metaclasses, in This representation must, therefore, allow a dynamic the object languages created above Lisp, then in Smalltalk classification of logical objects and follow classificatory 80 [37]. This vision was taken up again in Java, where reasoning. Reasoning by classification consists of finding the everything is an object, the elements of world representation, most specialized class or category to which an object belongs the elements of graphical interfaces, and the elements of the and retrieving knowledge related to this location. language like functions, classes, events, errors, and This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/) Macaire Ngomo et al. / IJCTT, 68(11), 24-42, 2020 exceptions. The composition was later added as an case with Java and UML, which distinguish two forms of autonomous dimension with UML and is present in modern inheritance: class inheritance is an inheritance of structures languages such as Java. and behaviours, interface inheritance is only an inheritance of behaviours. An inherited class is generally an abstract A. Encapsulation class, which will have no instance, but which constitutes an In the object paradigm, encapsulation concerns the algebraic type (a structure with operations). You can have as grouping of variables and functions into classes and the many levels of inheritance as you want. When a class grouping of classes and interfaces into packages. Classes, inherits from a more abstract class, it inherits its attributes functions, and packages are also namespaces that ensure and its operations or methods. uniqueness within the names of the elements composing Multiple inheritances them. From the outside, it may be necessary to prefix the names of imported public elements by the name of the class Multiple inheritance is an extension to the simple or package from which the referenced element comes (or by inheritance model where one class is allowed to have several this or by super). Encapsulation ensures the grouping in the parent classes to model multiple generalizations. An object same elements (classes or packages) of lower-level elements can be considered from several points of view. This is the strongly linked. It ensures the protection and partial main reason we have to consider multiple inheritances. For visibility of the elements outside. Encapsulation ensures the example, the cathedral of Notre-Dame de Paris is both a independence between a class's layout, a function, a work of art and a place of worship. Care must be taken to package, and how it is presented concerning the other avoid homonymy, which should not mix two structures objects using it. The public presentation of an element instead of giving them two different names. At first glance, ensures that a contract will bind that element about what it it seems that one class can inherit from several classes does, but not how it does it, which is the responsibility of its because an object can have several parts, and the object has implantation. Therefore, it can be changed without affecting been attributed to the properties of its parts (metonymy). the operation of the other elements that use it, for example, However, only the question of points of view corresponds to to change internal variables or the algorithms used. The inheritance because if an object is composed of several parts, encapsulation and access levels (private, public, etc.) give it will be constructed by a compositional mechanism. At the rise to the reusability of software elements and software design stage, it is legitimate to describe a class inheriting evolution. from several classes. If the programming language used does not allow multiple inheritances, the problem will have to be B. Inheritance solved at the implementation stage. The organization of classes in specialization hierarchies The use of multiple inheritances is not without its makes it possible to create complex classes from more problems. For example, if the two base classes have general classes by refining the general description. A attributes or methods with the same name, there are naming subclass is built from another class by adding members or collisions that need to be resolved. In programming, restricting members existing in the other class. The managing multiple inheritances of structures is difficult mechanism by which a class retrieves information inherited because if inheritance causes a conflict over attributes, you from its superclasses is called inheritance. Inheritance is, have to rename an attribute in one of the classes or see the therefore, a mechanism for sharing information by factoring design error that causes the Conflict. If inheritance causes a in members. Inheritance between classes allows the reuse of conflict of methods, a conflict resolution strategy, i.e., a the structures or behaviours introduced, and facilitating choice or combination procedure as in CLOS [6] [22] [43], updating, avoiding duplication of information. When several should be used. This is why some languages such as classes have common characteristics, it is possible to create Smalltalk or Java prohibit multiple inheritances of a more general classifier that groups