Visual Introduction to UML for Object-Oriented Design

A UML formal parameter that is preceded by in or nothing has the value of its actual parameter passed into the operation. However, the operation cannot modify the actual parameter's value. This is similar to a parameter of a Java method or a VB.NET parameter that is preceded by ByVal.

A UML formal parameter that is preceded by inout has the value of its actual parameter passed into the operation. Any changes that the operation makes to the value of its formal parameter cause the value of the actual parameter to be modified. This similar to a VB.NET parameter that is preceded by ByRef.

The usual way to implement this in Java is to make the value of a method's parameter a single element array. The value of the array element is used as the parameter value. The method can change the value of the actual parameter by modifying the value of the array's element.

A UML formal parameter that is preceded by out is used only to pass a value out of the operation.

The operations shown in the class in Figure 1 are preceded by a word in guillemets (double angle brackets), like this:

«constructor»

In a UML drawing, a word in guillemets is called a stereotype. A stereotype is used like an adjective to modify what comes after it. Some stereotypes have predefined meanings. The «constructor» stereotype indicates that the operations following it are constructors. The «misc» stereotype indicates that the operations following it are regular operations.

One last element that appears in Figure 1 is an ellipsis (…). If an ellipsis appears in the bottom compartment of a class, the class has additional operations that the diagram does not show. If an ellipsis appears in the middle compartment of a class, it means that the class has additional variables that the diagram does not show.

Often, it is not necessary or helpful to show as many details of a class as were shown in the preceding class in Figure 1. We may choose to omit details because we have not decided them yet or because they seem extraneous. As is shown in Figure 2, a class may be drawn with only two compartments.

Figure 2: A Two Compartment Class

It is common in UML diagrams not to include all possible details. The usual reason for leaving a detail out of a diagram is either that the detail is not relevant or that the detail has not yet been decided. UML syntax allows most details of a class, other than its name, to be omitted.

When a class is drawn with only two compartments, as shown in Figure 2, its top compartment contains the class's name and its bottom compartment shows the class's operations. Leaving out the compartment that contains the attributes just means that the class's attributes are not shown. It does not mean that the class has no attributes.

Visibility indicators may be omitted. When an operation or attribute is shown without a visibility indicator, it means there is no indication of the operation's or attribute's visibility. It does not imply that they are public, protected, or private.

An operation's parameters may be omitted if its return values also are omitted. Omitting an operation's parameters is common in a high-level design that just identifies operations. In Figure 3, for example, the return values and parameters are omitted from the class.

Figure 3: A Simplified Class

The simplest form of a class has just one compartment that contains the class name, as shown in Figure 4.