Об’єктно-орієнтований підхід в програмуванні. Композиційна взаємодія об’єктів - Улічев, О. С.; Буравченко, К. О.; Поліщук, Л. І.; Ulichev, О.; Buravchenko, К.; Polishchuk, L. (ЦНТУ, 2022)
В даній статті проведено дослідження певних аспектів об’єктно-орієнтованого підходу в програмуванні. Основну увагу приділено поняттям взаємодії об’єктів та композиційної взаємодії. В статті розглядається ієрархія взаємодії та особливості конкретних способів її реалізації. На основі опрацьованих матеріалів (навчальних посібників, книги з даної тематики, професійних дискусій розробників) запропоновано трактування основних типів взаємодій. This article aims to consider the types of interaction, in particular the compositional interaction between objects, and to identify the characteristics of individual types. The aim of the article is to clarify the essence of the concepts of different types of relationships between classes. The article proposes a number of theses that illustrate the ambiguity of the interpretation of concepts - types of connections. In the following calculations, different types of interaction are illustrated by examples and one of the options for interpretation and classification of compositional interaction is proposed. Analysis of a number of literature sources and articles in professional forums leads to the conclusion that the question of specifying the types of interaction and determining - which of the types should be implemented in a given case, is quite complex, despite the simplicity of its formulation. Some theses: 1) At the level of the basic definitions of OOP: composition is one of the types of interaction between objects in OOP (along with aggregation and association). But even at this stage, contradictions were found, in some sources the authors describe (suggest) that aggregation and composition are subspecies of association; 2) Many publications consider the interaction of objects at the level of opposition of "inheritance" and "composition". And this approach involves considering the interaction of objects at a higher level of abstraction, it is not considered the mechanisms of OOP, but rather the philosophy of the programming paradigm and the objective way of thinking; 3) In fact, there are no clear formal rules and restrictions (most modern OOP languages are quite flexible) and a specific approach to interaction between objects in building the object hierarchy is chosen directly by the developer (architect, programmer, etc.). The question of compliance of one or another configuration of the interaction of objects with the principles of OOP is very ambiguous. The flexibility of the OOP is both an advantage and a disadvantage of the paradigm at the same time, and this particular issue of the interaction of objects once again demonstrates this fact. There are two main interpretations of the relationship, one formed in the Society of C ++ developers (taking into account the peculiarities of OOP in this programming language), the other is based on the principles and specifications of UML. Thus, although UML placed the terms "aggregation" and "composition" in a specific context ("part-whole" relationship), but the authors of the notation failed to define them clearly and unambiguously, the decision is largely left to the intuition of developers.
Object-oriented Approach in Programming. Compositional in Teraction of Objects
Keywords: об’єктно-орієнтований підхід; клас; об’єкт; взаємодія; міжоб’єктні зв’язки; object-oriented programming; UML; aggregation; association; composition; objects relationship