After program is separated into small object, these objects must be connected with each over. Where are different types of connection. Inheritance, composition, aggregation, delegation. These types has many kinds and patterns like loose coupling, tight coupling, inversion of control, delegation via interfaces etc. What is a correct common name for mentioned types of connections? I can suggest that they all are called 'coupling', but i can't find any good classification in google, so maybe i'm trying to use a wrong term? Maybe anyone knows a solid, trusted classification that i can user for terminology?
These are generally called "relationships".
Taken from Object-Oriented Programming with Java: An Introduction by David J. Barnes:
See aggregation.
See inheritance.
When a super class is extended by a sub class, a class inheritance relationship exists between them.
A relationship in which an object contains one/more other subordinate objects as part of its state.
The process by which an object passes on a message it has received to a sub-ordinate object. If inheritance is not available in a programming language, delegation is the most viable alternative for avoiding code duplication and promoting code reuse.
I would refer to those as Associations, which can mean anything from composition to inheritance, these two objects are "related". However Relationships work as well, and i am going to guess most would argue "Relationships" is the better term.
Inheritance - a relationship between two types which implies a mechanism for reuse of behaviour
composition - a structural relationship implying whole/part relationship and that the part cannot exist without the whole
aggregation - a structural relationship implying whole/part relationship and that the part can exist without the whole
delegation - a behavioural relationship where a set of behaviours is provided by a different object to the primary receiver of a message.
What is a correct common name for mentioned types of connections?
They are relationships, but are different kinds of relationships - inheritance is a relationship between types, composition and aggregation relationships between objects, and delegation a behavioural relationship. You could have all three kinds present between the same two classes orthogonally.
I can suggest that they all are called 'coupling'
Each one will create (in UML terminology) a «uses» dependency from the package containing the client to the package containing the supplier. When creating dependency graphs between modules in a system, I find it useful to separate simple dependencies and classifier uses (such as the type of an operation, parameter or property); to correctly function you need to import the classifiers used by the elements you depend on, but you don't directly need transitive dependencies or dependencies of classifiers.
The simple answer is it's the relationship between objects in object-oriented programming.
Enterprise Patterns Should provide quite a bit of reference material and identify commonly used names in the industry.
UML is an accepted standard that provides some terminology you may want to borrow.
From the UML specification v2.3 ( http://www.omg.org/spec/UML/2.3/Infrastructure/PDF/ ):
An association describes a set of tuples whose values refer to typed instances. An instance of an association is called a link.
In other words, if I'm reading this correctly, an association specifically relates instances of classes to each other. Aggregation and composition are kinds of associations. However, in the formal language of UML, generalization (inheritance) and delegation are not.
As it turns out, UML also has the concept of a relationship. Again, from the spec:
Relationship is an abstract concept that specifies some kind of relationship between elements.
I would say that's broad enough to cover all your four terms.
That said, UML is not necessarily the only arbiter in defining these terms. UML evolved from several OO methodologies that used the terms "association" and "relationship" pretty much interchangeably. From the point of view of general accepted practice, I don't think you'll be confusing users by using one or the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With