liveBook · Manning

UML class diagram

As explained in Software Design for Python Programmers

A UML class diagram is a standardized graphical model that represents classes, their members, and relationships such as aggregation and composition.

A UML class diagram documents class design by showing a class name and, optionally, its instance variables and methods. Method signatures can include parameter and return-value datatypes. section 4.3

Choose the diagram’s detail level for its design purpose:

  • Use a class name alone for a high-level view. section 4.3
  • Add instance variables and methods for progressively more detailed documentation. section 4.3
  • Mark intended visibility with + for public and − for private members; omit constructors, destructors, and unimportant accessors when appropriate. section 4.3
  • Show relationships between classes to clarify how their objects interact at run time. section 4.7
Figure 4.2 Possible UML class diagrams for class Catalogue that include different amounts of information. A plus sign (+) indicates what is intended to be public, and a minus sign (-) indicates what is intended to be private. How much information to include in a class diagram depends on whether the diagram is in high-level or low-level design documentation of the application.
A close-up of a list

Description automatically generated

Compare four levels of information in a Catalogue class diagram, from the class name alone to members and methods. section 4.3

How Software Design for Python Programmers covers it

How deep it goes
Explains notation, visibility, signatures, detail levels, and class relationships, while stopping short of formal diagram construction procedures.
Examples
Uses Catalogue and Attributes diagrams, including progressively detailed compartments and a private static method.
What you can do after
Evaluate class structure and runtime relationships using appropriately detailed diagrams.
How it connects
Connects class design with dependency, aggregation, composition, generalization, state diagrams, sequence diagrams, and design specifications.

Also explained in

Compare how 3 books explain UML class diagram →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Design for Python Programmers. The section links point to the parts of the book it draws on.