JAL Computing

C++COMProgramming .NET Mac Palm CPP/CLI Hobbies

 

Home
Up

Chapter 12 "Unified Modeling Language"

I decided to try my hand at annotating the chapters using the UML (Unified Modeling Language) graphical notation. I am having no success finding a standard, language neutral way to represent a C# Property! The use of a <<property>> attribute stereotype and get/set operations is a language dependent notation useful when documenting a Java Bean Property. I have resorted to using the <<property>> stereotype and tagged attribute constraints ({get}, {set} or {get, set}) to represent a generic Property. This notation should work with a Java Bean or a C# Property, allowing a parser to generate a language specific implementation. I am also having trouble representing a structure, virtual methods, overriding and new so I have, naturally, resorted to a twisted notation.

If you are interested in further reading, check out "The Unified Modeling Language User Guide" Booch, Rumbaugh and Jacobson, Addison Wesley, 1999, 482pp.

According to Booch, Rumbaugh and Jacobson, UML (Unified Modeling Language) is "a graphical language for visualizing, specifying, and documenting the artifacts of a software intensive system." The use of a standard graphical notation allows programmatic conversion of graphical views to text views and vice versa. More importantly, the UML facilitates the design process. You can extend the UML notation using <<stereotypes>> or {tagged values}. Hopefully, you have absorbed the graphical notation of the UML by osmosis in the previous eleven chapters! I have compiled all of the UML diagrams into this, the twelfth twisted chapter on OOP. 

Chapter 1

Figure 1a. Class View.

Figure 1b. Class With Accessors.

A Class is modeled as a rectangle with four components:
bulletName
bulletAttributes
bulletOperations
bulletResponsibilities (Optional)

Some information can be elided or left out (...). Adornments can be used to add detail such as the visibility modifiers:

bullet- private
bullet# protected
bullet+ public

In the Toaster class the attribute secondsToToast has private visibility which can be notated as: 

- secondsToToast : int

C# properties are methods that appear as attributes so I have used the UML's support for extensibility using the stereotype <<property>> and a tagged constraint to convey the get only, set only or get/set state of a property.

Figure 1c. Twisted Class With a Get and Set Property (Non Standard UML)

Chapter 2

Inheritance is represented using the triangle notation:

Figure 2a. Inheritance.

Composition is represented using the black diamond notation. In this case, the lifetime of the Radio object is dependent on the lifetime of the Car object so that the Car object contains the actual Radio object. You can use the white diamond notation to represent containment by reference (see Figure 7a below).

Figure 2b. Inheritance and Containment By Ownership.

Abstract classes can be represented by the tagged value {abstract}. An abstract method is notated in italic.

Figure 2c. Inheritance and Abstract Class.

Chapter 3

 

Figure 3a. The Model-ViewController Architecture.

Chapter 4

Static attributes and operations are notated using an underline.

Figure 4a. A static attribute and static operation.

Figure 4b. The Drawable classes.

Figure 4c. The Factory class.

Chapter 5

Figure 5a. int is an alias for the structure System.Int32.

An enumeration can be notated using a rectangle and the <<enumeration>> stereotype.

Figure 5b. An enumeration.

Chapter 6

Figure 6a. The TextBox Hierarchy.

Chapter 7

You can represent containment by reference using the white diamond notation. The white diamond notation is used to represent aggregation. If you want to represent containment by ownership, use the black diamond notation (see Figure 2b above).

Figure 7a. Containment by Reference.

Chapter 8

Figure 8a. Shadow Fields, Override Virtual Methods using twisted notation.

Chapter 9

You can represent an interface using the lollipop or expanded rectangle notation.

Figure 9a. The Circle Class using the lollipop interface notation.

Figure 9b. The Square Class using the expanded interface notation.

Chapter 10

Hey, this just looks cool!

Figure 10a. A Sequence Diagram of Indirection.

Chapter 11

Figure 11a. A Structure with Properties using twisted notation.

Chapter 12

<<big grin>>

See ya.

 

Send mail to [email protected] with questions or comments about this web site. Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 © 
Last modified: 08/04/09
Hosted by www.Geocities.ws

1