Unified Modelling Language
Introduction to Software Engineering (CSSE 1001)
Unified Modelling Language (UML)
A unified modelling language diagram is the standard way of illustrating relationships among classes.
For instance, for our Animal class we have…
UML Class Diagram
A class diagram is a type of UML that shows:
- Classes and their attributes/methods
- Relationships (e.g., inheritance, composition, association)
Class diagrams are great for object-oriented design.
Each class is represented by a box which has three parts:
| Section | Content | Example |
|---|---|---|
| Top | Class Name | Animal |
| Middle | Attributes | name: str |
| Bottom | Methods | speak(): str |
Visibility markers:
+public#protected‑private
Inheritance
Each subclass inherits from Animal and adds a speak() method.
UML Association
Describes a “uses/knows about” relationship
UML Multiplicity
Multiplicity shows how many objects are involved in a relationship.
| Symbol | Meaning |
|---|---|
| 0..1 | Zero or one |
| n | Exactly n |
| 0..* | Zero to many |
| 1..* | One to many |
| m..n | Range m to n |
UML Composition
Composition is the “has a” relationship. Here, the “part” cannot exist independently of the “whole”.
A Heart cannot outlive its Animal.
UML Aggregation
Aggregation is a weaker form of composition, where the “part” can exist independently of the “whole”.
Owner can have multiple Animals, and can exist independently of those animals.
Exercise
Try modelling a UML diagram for a DroneFlight class and its child DeliveryDrone class.
Summary
UML is a visual language used to design and describe software systems.
In object-oriented programming, class diagrams are one of the most used UML tools.
They help represent the structure of a system by showing classes, their attributes and methods, and the relationships between them such as inheritance, association, aggregation, and composition.
Using UML before writing code makes it easier to plan, communicate, and maintain software designs effectively.