8. UML diagram: associations (2)

Another common type of association is the uni-directional association.

Keeping with the train example, consider the diagram below.

uni-directional association

The uni-directional association is indicated by an open arrow line pointing towards the 'one-sided' part of the association. In this case a timetable class is associated with zero or more train journeys ( 0..*). Each journey takes on the role of assignedJourney for the timetable class.

On the other hand, the train journey class knows nothing about the timetable class. This is generally a good thing because it means the time table class has no effect at all on the train journey class.

This lack of dependency is often called a 'loose coupling' and it makes the system more robust and flexible. If you have a team putting together the timetable class, their work should have little or no impact on the people coding up the train journey class.

On the other hand if there was tight coupling between classes, then each class-coder needs to be mindful of the work going on with the other class. Tight coupling generally makes it a bit more difficult to make changes later on to the system as changes in one class may affect another class.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: UML class association

 

 

 

Copyright © www.teach-ict.com