UML Diagram

Aggregation and Composition

Relationships between components, for example:

Owners, pets, tails:

  • Owners feed pets, pets please owners (association)
  • A tail is a part of both dogs and cats (aggregation/composition)
  • A cat is a kind of pet (inheritance/generalization)

Aggregation and Composition

Aggregation and Composition are subsets of association meaning they are specific cases of association. In both aggregation and composition object of one class “owns” object of another class. But there is a subtle difference:

  • Aggregation implies a relationship where the child can exist independently of the parent. Example: Class (parent) and Student (child). Delete the Class and the Students still exist.
  • Composition implies a relationship where the child cannot exist independent of the parent. Example: House (parent) and Room (child). Rooms don’t exist separate to a House.
  • Generalization is implemented as inheritance.
  • Inheritance: “is-a”; composition: “has-a”.

Visibility of any class members are marked by notations of:

FavoriteLoadingAdd to favorites

RECENT POSTS


Categories



Tags

ADO ai angular asian asp.net asp.net core azure ACA azure administration Azure Cloud Architect Azure Key Vault Azure Storage Blazor WebAssembly BLOB bootstrap Branch and Release flow c# c#; ef core css datatables design pattern docker excel framework Git guide HTML JavaScript jQuery json knockout lab LINQ linux powershell REST API smart home SQL Agent SQL server SSIS SSL SVG Icon visual studio Web API window os wordpress


ARCHIVE


DISCLAIMER