Tu banner alternativo

Association (object-oriented programming)

In today's article we are going to delve into the fascinating world of Association (object-oriented programming), a topic that has captured the attention of experts and fans alike. Since its emergence, Association (object-oriented programming) has demonstrated its impact on various aspects of society, science, culture and history. Over the years, it has been the subject of debate, study and research, and its influence has continued to evolve over time. In this in-depth exploration of Association (object-oriented programming), we will examine its origins, its relevance in today's world, and the various perspectives that exist around this topic. Prepare to immerse yourself in a journey that promises to surprise, excite and educate, as we discover together the exciting universe of Association (object-oriented programming).

Tu banner alternativo

In object-oriented programming, association defines a relationship between classes of objects that allows one object instance to cause another to perform an action on its behalf. This relationship is structural, because it specifies that objects of one kind are connected to objects of another and does not represent behaviour.

Top: A bidirectional association
Middle: An association is bidirectional, although it may be limited to just one direction by adorning some end with an arrowhead pointing to the direction of traversal.
Bottom: Association is prohibited

In generic terms, the causation is usually called "sending a message", "invoking a method" or "calling a member function" to the controlled object. Concrete implementation usually requires the requesting object to invoke a method or member function using a reference or pointer to the memory location of the controlled object.

The objects that are related via the association are considered to act in a role with respect to the association, if object's current state in the active situation allows the other associated objects to use the object in the manner specified by the role. A role can be used to distinguish two objects of the same class when describing its use in the context of the association. A role describes the public aspects of an object with respect to an association.[1]

The ends of the association can have all the characteristics of a property:

  • They can have a multiplicity, expressed by a lower and an upper limit in the form of "lowerLimit..upperLimit".
  • You can have a name.
  • You can declare a visibility.
  • You can specify whether the end of the association is ordered and / or unique.

See also

References

  1. ^ Rumbaugh, JR; et al. (1991). Object-oriented modeling and design. Prentice Hall. ISBN 0-13-630054-5.