01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

102<br />

Saturday Morning<br />

Operation compartment<br />

In Figure 9-2, the operations compartment occupies the bottom section of the class box.<br />

Operations are simply listed in the operation compartment using the notation presented in<br />

“Modeling an Operation.” The order does not matter. The operation compartment is placed<br />

below the name compartment, and below the attribute compartment when all compartments<br />

are visible.<br />

Creating Different Views of a Class<br />

The completed class definition can be shown with all three compartments visible or as just<br />

the name compartment. This form is often used in the early stages of analysis when the<br />

focus is on object definitions and relationships. As more information is discovered about the<br />

attributes and operations, the other two compartments can be revealed as well.<br />

Some tools also give the option to show some or all of the operation specifications. For<br />

example, one view may show only the operation names. Another view may reveal the names<br />

and the arguments, while yet another may show the entire signature with argument data<br />

types and return data types. Figure 9-3 illustrates two ways of drawing the class symbol.<br />

This facility helps focus evaluation of the diagram to the interests of the audience.<br />

<br />

Customer<br />

{last updated 12-15-01}<br />

<br />

Customer<br />

{last updated 12-15-01}<br />

- name: String = blank<br />

- mailingaddress: Address = null<br />

- /accountbalance: Dollar = 0<br />

- customerid: integer = none {assigned by system}<br />

<br />

Customer<br />

{last updated 12-15-01}<br />

+ getName (): String<br />

+ setName (name: String)<br />

+ setAccountBalance (amount: Dollar)<br />

+ getAccountBalance (): Dollar<br />

+ setMailingAddress(street1: String, street2: String,<br />

city: String, state: State, zipcode: integer)<br />

Figure 9-3<br />

Alternative views of a class symbol for different audiences and purposes<br />

REVIEW<br />

The Class diagram is the primary diagram for code generation and for reverse engineering.<br />

Consequently, it tends to be the focus of most modeling efforts, with all the other diagrams<br />

playing a supporting role. The term object model is actually a reference to two diagrams, the<br />

Class diagram and the Object diagram, although when the term is used it most often refers<br />

to a Class diagram.<br />

The Class diagram represents all the rules regarding the construction and use of<br />

objects. The Object diagram describes the facts about objects that actually exist.<br />

Consequently, the Object diagram provides a valuable testing tool to verify the Class<br />

diagram.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!