When modelling a plan for a code project, it is helpful to identify Class relationships, which indicate how classes interact with each other.
There are four types of class relationships:
- Generalisation (Inheritance) - Is-a relationship
- Association - Has-a relationship
- Aggregation - Classes can exist independent of each other
- Composition - Classes cannot exist independently
- Realisation (Interface) - Can-do relationship
- Dependency - Needs a relationship
Difference between association and dependency
In most cases they are very similar, but association implies dependency, not the other way around. If Class A contains Class B, Class B is associated with Class A, and also depends on it. https://stackoverflow.com/questions/1230889/difference-between-association-and-dependency #TODO ,