Class Diagrams

Class diagrams are the most common type of UML diagram, used to model the static structure of a system by showing classes, their attributes, operations, and relationships.

Creating Classes

Using the Class Tool

On a UML Class Diagram page, press U or choose Class from the toolbar's UML menu. Click on the canvas to place a class box, or drag to set its size. Press Return with a class selected to rename it.

Class Box Structure

A UML class box consists of three compartments:

  1. Name compartment - Contains the class name and optional stereotype
  2. Attributes compartment - Lists the class properties/fields
  3. Operations compartment - Lists the class methods/functions

Class Properties

Select a class and use the Inspector's Arrange tab → UML section to configure its properties:

Name

The class name appears in bold in the top compartment. Convention uses PascalCase (e.g., CustomerOrder).

Stereotype

Optional classifier that appears above the class name in guillemets:

  • <<interface>> - For interface definitions
  • <<abstract>> - For abstract classes
  • <<enumeration>> - For enum types
  • <<entity>> - For domain entities
  • Custom stereotypes are also supported

Abstract

Toggle to render the class name in italics, indicating an abstract class.

Constrained resize

When on (the default), resizing keeps the class box's proportions.

Attributes

Attributes represent the data/properties of a class.

Adding Attributes

  1. Select the class
  2. In the UML section, find Attributes — a multi-line editor with one attribute per line
  3. Click + (or press Cmd+L) to add a new attribute, then type its details

Attribute Syntax

Attributes follow this format: visibility name : type

Visibility Modifiers:

SymbolMeaningDescription
+PublicAccessible from anywhere
-PrivateAccessible only within the class
#ProtectedAccessible within class and subclasses
~PackageAccessible within the same package

Examples:

  • -id: Int - Private integer ID
  • +name: String - Public string name
  • #createdAt: Date - Protected date field
  • ~cache: Map<String, Any> - Package-private cache

Operations

Operations represent the behavior/methods of a class.

Adding Operations

  1. Select the class
  2. In the UML section, find Operations — a multi-line editor with one operation per line
  3. Click + (or press Shift+Cmd+L) to add a new operation, then type its details

Operation Syntax

Operations follow this format: visibility name(parameters) : returnType

Examples:

  • +getName(): String - Public getter returning String
  • -validate(input: String): Boolean - Private validation method
  • +process(data: Data, options: Options): Result - Method with multiple parameters
  • +save(): void - Method with no return value

Relationships

Press R to activate the Relationship tool, then drag from one class to another to create a connection.

Relationship Types

TypeLine StyleArrowUse Case
AssociationSolid lineOpen arrowGeneral relationship
DependencyDashed lineOpen arrow"Uses" relationship
InheritanceSolid lineHollow triangle"Is-a" relationship (extends)
RealizationDashed lineHollow triangleInterface implementation
AggregationSolid lineHollow diamond"Has-a" (weak ownership)
CompositionSolid lineFilled diamond"Has-a" (strong ownership)

Creating Relationships

  1. Press R to activate the Relationship tool
  2. Click on the source class
  3. Drag to the target class
  4. Release to create the connection
  5. Use the Inspector's UML section to set the Relationship Type — the line style and arrowheads follow the type

Relationship Labels

Select a relationship and set its labels in the Inspector's UML section:

  • Label - Describes the relationship (e.g., "manages", "contains")
  • Multiplicity - Source and Target values indicating how many instances (e.g., "1", "0..", "1..")

Best Practices

  1. Keep it simple - Don't try to model everything; focus on key classes
  2. Use stereotypes - Clearly mark interfaces and abstract classes
  3. Show key relationships - Not every association needs to be shown
  4. Consistent naming - Use PascalCase for classes, camelCase for members
  5. Group related classes - Use visual proximity to show logical groupings