liveBook · Manning

UML class diagram

As explained in Data-Oriented Programming: Reduce software complexity

A UML class diagram is a structural diagram that represents classes, their attributes and operations, and relationships between them.

A UML class diagram turns a system idea into a map of classes and their relationships before coding begins. In the library-management example, the design names Library, Book, BookItem, BookLending, Member, Librarian, User, Catalog, and Author—useful structure, but also a warning: drawing the system can expose how many connections the design requires. section 1.1.1

The library diagram

Theo models a Library owning a Catalog and many Members, while Books and Authors have an independent many-to-many association. The diagram also distinguishes inheritance, usage, and composition. A plain diamond marks composition; an empty diamond marks association; dashed arrows represent usage; inheritance shows a class deriving from another. section 1.1.2

The diagram is not merely a planning ornament. Counting entities and relations provides a quick complexity check. Member participates in five relations: it belongs to a Library, has BookLendings, extends User, is used by Librarian, and uses BookItem. Splitting class code from class data produces more independent parts that are easier to understand. section 1.2.1

Figure 1.1 A class diagram for Klafim’s Global Library Management System

Inspect the complete Klafim library-management class diagram, then trace how its entities and relationships create the proposed object-oriented structure. section 1.1.1

How Data-Oriented Programming: Reduce software complexity covers it

How deep it goes
Explains four relationship types and applies them to a library system, then assesses complexity through relation counts.
Examples
Uses a library-management diagram containing Library, Member, Book, Author, Catalog, and BookLending relationships.
What it assumes
Assumes only a system scenario and introduces composition, association, inheritance, and usage terminology.
What you can do after
Evaluate a proposed object-oriented design by reading relationship notation and locating highly connected classes.
How it connects
Connects classes with composition, association, inheritance, usage, object-oriented programming, and code-data separation.

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 Data-Oriented Programming: Reduce software complexity. The section links point to the parts of the book it draws on.