Software engineering Β· Free university study guide
UML Class Diagram Multiplicities, Explained with a Worked Library Example
Learn to interpret 1, 0..1, 0..* and 1..* without guessing. Follow a worked diagram, common mistake corrections, PlantUML notation, and a short self-check.
Download free UML worked-example PDFQUICK ANSWER
In a UML class diagram, multiplicity tells you how many instances of a class may be associated with one instance of the class at the opposite end. For example, 0..* beside Loan means that one Member may have zero or many Loan records; 1 beside Member means every Loan belongs to exactly one Member.
1. What do UML multiplicity symbols mean?
A UML association connects classes. Its multiplicity is written near an association endpoint, not in the middle of the line. Reading the number from the correct direction is more important than memorising a table.
| Notation | Interpretation | University project example |
|---|---|---|
| 1 | Exactly one | Each Loan has one Member |
| 0..1 | Optional: zero or one | A User may have one Profile |
| 0..* | Zero or more | One Member may have many Loans |
| 1..* | At least one | A Team must contain one or more Members, if that is a stated requirement |
| 2..5 | Between two and five | A lab group has between two and five participants, if required |
A useful test: Point to a single object on one side, then ask how many objects on the other side it can connect to. The answer determines the number written at that other end.
2. Worked example: a library borrowing system
Consider an original teaching scenario: a university library stores members, books and borrowing transactions. A loan records its borrowedOn and dueOn dates. That information belongs to a specific borrowing event, so a separate Loan class is useful.
READ THE TWO ASSOCIATIONS
Member "1" -------- "0..*" Loan Book "1" -------- "0..*" Loan
Download the illustrated PDF class diagram for a visual version of these relationships.
Member to Loan
Each Loan belongs to exactly one Member. A new Member can have zero loans, while a returning member may have many. Therefore write 1 at the Member end and 0..* at the Loan end.
Book to Loan
Each Loan records exactly one Book. A Book may never have been borrowed, or it may have a long history of Loan records. The multiplicities are 1 at Book and 0..* at Loan. Here we are talking about historical records, not how many students may hold a physical copy simultaneously.
A modelling detail that earns careful attention
A business rule such as βone physical copy cannot have two active loansβ is not enforced just by the historical 0..* association. Your project may need a status field, a constraint, or a carefully chosen modelling refinement to handle that rule.
In the free-sample library you can see the complete diagram, two explanatory tables and a short answer key.
3. Draw the example using PlantUML
You can practise with the following original class model using the syntax described in the official PlantUML class diagram guide. Paste it into a PlantUML editor and examine the position of each label.
@startuml
skinparam classAttributeIconSize 0
class Member {
memberId: Integer
name: String
}
class Book {
isbn: String
title: String
}
class Loan {
borrowedOn: Date
dueOn: Date
}
Member "1" -- "0..*" Loan : makes
Book "1" -- "0..*" Loan : recorded in
@enduml
For a more developed university design, you might add methods, return dates, a librarian workflow and explicit validation rules. Each addition should trace back to a requirement rather than appearing just to make the diagram look complicated.
4. Common UML multiplicity mistakes
Mistake 1: Reading the number beside the wrong class
If a diagram says Member "1" -- "0..*" Loan, the 0..* is about how many Loans a Member may have. Reading it as βa Loan has many Membersβ reverses the model.
Mistake 2: Using 1..* when zero is possible
A student may join a university system before enrolling in a module. If the requirements allow that case, use 0..* rather than 1..* for the relevant enrollment end.
Mistake 3: Losing transaction attributes
Drawing a direct many-to-many line between Member and Book could conceal details such as borrowing date or due date. An explicit Loan class makes transaction details visible and easier to validate.
Mistake 4: Confusing association with composition
Multiplicity counts links; aggregation and composition describe a different aspect of the relationship. Do not add a filled diamond without a justified lifetime/ownership rule.
Mistake 5: Treating the diagram as the entire specification
Class diagrams clarify structure. They do not automatically express every timing, validation or concurrency rule. Explain important constraints in supporting documentation and check them against sample scenarios.
5. Try this university student exercise
Scenario: A student can enroll in up to five modules. A module may currently have no students, or many students. Each student may enroll in zero modules while registration is open.
Question: What multiplicities belong at the Student and Module ends of a direct association, assuming no enrolment-date or grade data needs modelling?
Reveal the worked answer
Write 0..* at the Student end, because a Module can have many Students. Write 0..5 at the Module end, because each Student can enroll in up to five Modules. If enrolment dates or grades must be stored for each registration, introduce an Enrollment class and model those records explicitly.
Want to compare your reasoning with a diagram? Start with the free downloadable worked example and use the same reading technique.
6. Frequently asked questions
Is 0..* the same as * in UML?
In commonly used UML multiplicity notation, an unbounded upper value is written *. 0..* explicitly indicates a lower bound of zero; writing it in full is helpful when teaching students to read both bounds.
What is the difference between 0..1 and 1?
0..1 allows no linked object or one linked object. 1 requires exactly one linked object. The difference often matters in systems where a record is created before optional details are entered.
Why create a Loan class rather than connecting Member and Book directly?
Loan represents an event with its own attributes. It can hold borrowedOn, dueOn and return-related details without confusing those values with permanent attributes of a Member or Book.
Can I use this diagram in a university assignment?
Use it for practice and understanding. Your submitted design should reflect your own assignment requirements, reasoning and your institution’s academic-integrity policy. A library example is not automatically a correct model for another scenario.
Free resource + personal guidance
Need help reviewing your own UML diagram?
We help university students interpret requirements, check multiplicities, explain diagram inconsistencies and improve software-design understanding through tutoring and feedback.
Related guides: UML class, sequence and use-case diagram help Β· Programming tutoring Β· Free student tools Β· More free academic samples.
Reference: Object Management Group, Unified Modeling Language specification. Examples in this guide are original instructional material rather than student submissions.


