Ashish Patel: Notes

Atom feed

Recently added: Untitled, Chest, Uml class, Uml class restaurant, Uml class library

Types of Relationships

1. Association

Association is: Class A uses Class B.

Example:

And in In UML diagram Association is denoted by a normal arrow head.

2. Aggregation

Class A contains Class B, or Class A has an instance of Class B.

An aggregation is used when life of object is independent of container object. But still container object owns the aggregated object.

So if we delete class A that doesn't mean that class B will also be deleted. E.g. none, or many, teachers can belong to one or many departments.

The relationship between Teachers and Departments is aggregation.

3. Composition

Class A owns Class B.

E.g. Body consists of Arm, Head, Legs. BankAccount consists of Balance and TransactionHistory.

So if class A gets deleted then also class B will get deleted.

Relationships Cheatsheet

UML Class

Mermaid class UML diagram syntax

Type Description
<|-- Inheritance
*-- Composition
o-- Aggregation
--> Association
-- Link (Solid)
..> Dependency
..|> Realization
.. Link (Dashed)

Created 2024-08-06T16:48:39+01:00, updated 2024-08-07T19:26:38+01:00 · History · Edit