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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Session 9—Modeling the Static View: The Class Diagram 101<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 />

+ 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-2<br />

Complete class specification with all three compartments<br />

Name compartment<br />

In Figure 9-2, the name compartment occupies the top section of the class box. The name<br />

compartment holds the class name, an optional stereotype, and optional properties. The<br />

name is located in the center of the compartment. The stereotype (>) may be used to<br />

limit the role of the class in the model and is placed at the top of the compartment.<br />

Common examples of class stereotypes include , based on the Factory design<br />

pattern, and , for Java interfaces or for user interfaces.<br />

Properties use the constraint notation { } and are placed in the bottom-right corner of<br />

the compartment. Properties are basically constraints used to clarify the intent in defining<br />

the model element. Properties can be used to document the status of a class under development<br />

or for designations such as abstract and concrete.<br />

Attribute compartment<br />

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

The attribute compartment simply lists the attribute specifications for the class using the<br />

notation presented earlier in “Modeling an Attribute.” The order of the attributes does not<br />

matter.

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

Saved successfully!

Ooh no, something went wrong!