UML class diagram visual syntax

The visual syntax that UML class diagrams use to show classes' attributes, methods, and is-a or has-a relationships is fairly straightforward. Each class is represented by a three-part rectangular box. The top portion is used for the class name. The middle portion lists the attributes and their types. The bottom portion lists the methods, the types of arguments they expect, and the type of value they return.

The relationships between classes are shown using two types of arrows. One with a traditional arrow head indicate is-a relationships. For example the diagram below shows that a Pentagon is-a type of Shape. Arrows with a diamond head indicate has-a relationships. In the diagram below we can see that a Shape has-a Location attribute named center.

.

UML class diagrams can have other adornments, in particular they can show the cardinality of the connections, but we will not be making use of that feature.

Finally, it is important to notice the difference between a UML class diagram and a memory diagram, e.g. the one drawn for Hunt the Wumpus in Module 10.