| Figure |
|
Variables
length: int width: int |
|
Methods
reshape(): void move(): void move(int, int): void |
Note that in this diagram, the links have the association name written on them. At the end of the links, are the specific identifiers of the association. These end up being variables in the classes. For example City is connected to Airport. So the City would probably have an "airport" Instance Variable and the Airport would probably have a "physical location" Instance Variable. You do not need to do this since if they are instance variables, you would have them listed in the Variables section
Which classes do you need to show? Every class that you use in your program should be shown:
More examples
Hence, one should only use Aggregation links (A-Part-Of) when that it the only reason a certain class is there (i.e., because it is a-part-of a bigger class that is needed). In general, links should give some kind of useful information. This example is OK because it uses aggregation for the GUI parts. I.E. the GUI has three containers to it and one of them holds a Button. It would have more useful information though, if the links said something like "figure controller" and "color chooser" since that is what the ToolBox and ColorBox do in the JPaint Applet
In general, Association links are meant to show the reader why a class was used. For example, perhaps it is the GUI and hence the "view/model" link in a Model/View/Controller architecture. Or, java interfaces connected to GUIs provide "view/controller" links. Always try to give useful information so the reader can look at the Object Model and have a very good idea how/why it all fits together.