Wednesday, July 2, 2008

UML,Class Diagrams & Netbeans 6.1

UML representation of a class has 3 compartments as shown in Figure 1

Figure 1

1. The name compartment (required) contains the class name and other documentation-related information: E.g.:
Some_class «abstract»

{ author: George Jetson
modified: 10/6/2999
checked_out: y
}
  • Guillemets identify stereotypes. E.g.: «utility», «abstract» «interface».
  • Can use a graphic instead of word.(«interface» often represented as small circle)
  • Access privileges or visibility (see below) can precede name
  • Use italics for abstract-class and interface names.
2. The attributes compartment (optional):
Everything except constant values must be private, Always.

3. The operations compartment (optional) contains method definitions:
message_name(arguments): return_type
Resist the temptation to use implementation-language syntax.

Visibility (access privileges) indicated as follows:


+public
#protected
~package
-private
--implementation visibility (inacessible to other objects)
(+)forced public.Override of an interface method
that should be treated as private, even if it's declared as public



How to create class diagrams in Netbeans 6.1

1. «utility», «abstract» «interface» can be created as shown in Figure 2

Figure 2

2. Attribute of a class can be created by right-clicking on the Attributes label in class diagram as shown in Figure 3.

Figure 3

3. Properties of the attribute can be set by selecting the new attribute by clicking on it and editing the properties as shown in Properties window (Figure 4)

Figure 4

4. Operation of a class can be created by right-clicking on the Operations label in class diagram as shown in Figure 5

Figure 5

5. Properties of the operation can be set by selecting the new operation by clicking on it and editing the properties as shown in Properties window (Figure 6)

Figure 6


References

No comments: