Once you have defined the classes and the associations in between them, you should specify their behaviors and attributes.
A class in a UML class diagram can contain two "compartments", one for the attributes and one for the behaviors.
You can specify the name, the type and the initial value of each attribute.
You can also enter the name, the arguments (incl. their names and types) and the return type of a behavior:
Rational Rose allows the user to hide individual attributes and behaviors from the compartments and hide the behaviors' signatures (i.e. their arguments and return type).
Unfortunately, it cannot hide attributes' types and initial values, which usually enlarges the class box so that it doesn't fit within the diagram.
On the other hand, attributes are not important in the initial analysis stages of the development and you can always supply a separate diagram for each class that depicts all the attributes and operations in the design stage.
An obvious conclusion is that attributes are represented as instance variables and behaviors as methods in Java.
Notice that attributes and roles are represented the same way, as instance variables.
When should an association role and attribute be used?
An attribute is used for a simple type (this is a constraint of the Rose, not of UML).
Beyond that, attributes are atomic for the purpose of a diagram and should not be used for important relations in between classes.
The author has over three and a half years of experience on developing web and object oriented application with a development focus on server side and enterprise Java .He is a regular writer for the European publication "Programmez!" and writes on and of for some online publications. He can be reached at sameertyagi@usa.net
JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for
Windows 95, 98, ME, NT, 2000 and XP. It's designed to
automatically optimize your Windows settings, boosting your
Internet connection up to 200%.
Blackmail Applet
This applet prints out text that looks like letters cut out of a
newspaper. You can specify the text, the width and height of the
applet and the delay after each letter. Future versions will
have more parameters.
While surveys suggest that small businesses aren't prepared for ever-present security dangers, this Boston-area printer has maintained a pristine operation since a scare six years ago.