Unified Modeling Language (UML)

Home

Table of Contents

UML

Class diagram

Figure 1 shows an example of a class diagram.

  • Person is a (extension of) Mammal,
  • Person has a public attribute: name,
  • Person implements the Flippable interface,
  • Person has a BackPack,
  • the eatMyApple method is private,
  • and the doBackFlip method is public.

Note the different type of arrows connecting the nodes.

uml-class-diagram-example.png

Figure 1: Example of a UML class diagram generated with yEd.

example-class-diagram.png

Figure 2: Example of a UML class diagram generated with PlantUML.

yEd

  • Graphs are saved as graphml files (an XML format), but you can also export them as PNG or SVG.
  • ctrl f to search a graph, you can also dock the search window. Then use the Nodes tab to select based on label text (or however else you want to search it).
  • Alt + Shift + g to use an organic layout of the graph.
  • Alt + Shift + h to use the heirarchical layout of the graph.
  • In the property of a UML node there are textboxes that allow you to enter methods and attributes

Examples

Database schema

uml-database-schema-example.png

Figure 3: Example of a visualisation of a database schema generated with yEd.

PlantUML

  • There is a spacemacs layer for PlantUML.
  • The file extension is .puml.
  • The listing 1 shows an example which corresponds to the figure above.
@startuml

note as FOOBAR #lightblue
Note
end note

interface Flippable {
        + void doBackFlip()
}

class Mammal

class BackPack {
        + Object apple
        + Object sandwich
}

class Person {
        + String name
        - BackPack myBackPack
        + void doBackFlip()
        - void eatMyApple()
}

Person --|> Mammal
Person ..|> Flippable
Person ..> BackPack

@enduml

Author: Alexander E. Zarebski

Created: 2025-01-11 Sat 12:22

Validate