Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend

To Associate Or Not

We have seen that we can use UML class diagrams to show classes with their attributes, operations, and associations to other classes. However, it may not be completely clear when we should show an object reference in a Java class as an association or as an attribute. The answer is, "Whatever communicates the required level of information to the intended readership of the diagram." Sometimes, it is worth including simple objects as classes on a class diagram and showing the references to them as associations. Other times, it is far better to leave them as attributes or even omit them from the diagram altogether to avoid having them distract from more significant classes and associations. Most UML diagramming tools provide a mechanism for hiding varying amounts of information in diagrams so you can switch between general and more detailed views. Speaking of tools...

  • + Share This
  • 🔖 Save To Your Account