Conceptly
← All Concepts
πŸ”—

Association

StructureA link that expresses references between objects

Association means that one object knows about or references another object. In object-oriented modeling, it is the most basic way to describe not only isolated objects but also the relationship graph between them.

β–ΆArchitecture Diagram

πŸ”— Relationship

Dashed line animations indicate the flow direction of data or requests

Why do you need it?

Real problems almost always include relationships between entities. If objects are modeled as isolated islands, orders no longer know customers, comments no longer know posts, and services no longer know their collaborators.

Why did this approach emerge?

Object-oriented analysis and modeling tools such as UML matured around the idea that systems are not just collections of types but graphs of related entities. That is why association and stronger relationship forms such as composition became as important as the classes themselves.

How does it work inside?

Association is usually implemented by one object holding a reference to another. Differences then arise around whether the relationship is one-way or two-way and whether one object points to one related object or many.

Boundaries & Distinctions

Association is the broadest relationship idea, while composition is a stricter form with stronger ownership and lifecycle coupling. If one object merely knows another, that is association; if the part exists only as part of the whole, the relationship moves closer to composition.

When should you use it?

Orders referencing customers, teams holding users, and controllers holding services are all examples of association. The danger is overusing bidirectional references, which can tangle dependency direction and make changes harder to reason about.

Model domain relationships -- connect orders to customers, posts to authors, and similar pairsSupport service collaboration -- let one object request work from anotherProvide navigation paths -- move from one object to related objectsClarify responsibility boundaries -- make explicit which objects know about which others