AlgoViz

UML class diagrams

easy 45 min

A class diagram is a picture of the types in a program and the lines between them.

Watch lesson4:49

Where it shows up

The same pattern appears across everyday software.

  • Mermaid

    Writes class diagrams as text: `<|--` for inheritance, `*--` for composition, `o--` for aggregation, numbers in quotes at the ends. Its documentation describes the same three compartments.

  • GitHub

    Draws Mermaid code blocks in issues, discussions, pull requests, wikis and Markdown files, so a diagram is reviewed like code.

  • PlantUML

    Another text form. It understands the four visibility characters in front of a member and draws icons for them.

  • IntelliJ IDEA

    Generates a class diagram for a package of your project. Its documentation says that such diagrams reflect the structure of the actual classes.

  • Visual Studio Class Designer

    Shows classes of a project as a diagram, and editing the diagram edits the code. It does not support .NET Core or .NET 5 and later.

  • pyreverse

    Comes with Pylint. Reads Python code and writes class and package diagrams, also as PlantUML or Mermaid text.

  • Doxygen

    Builds inheritance and collaboration pictures into the documentation of C++ and other code, and limits the depth so that pictures stay small.

  • django-extensions

    The command `graph_models` draws the models of a Django project and their links.

  • C4 model

    Four zoom levels for architecture. The last one, code, may be a UML class diagram, and the page calls it very much optional.

  • Eclipse Papyrus

    An open source modelling tool for UML, from the side of the world where models are blueprints.