home
post
uml - class diagram

UML - Class Diagram

Jan 14, 2024
3 min
7 charts

UML stands for Unified Modeling Language. It was created to communicate and document IT designs and architecture. UML class diagram is a static structure diagram, that describes interfaces, classes, attributes and methods, and relationships between.

What I like about UML class diagram, that the complexity in the diagram itself is optional. You can omit the attributes and methods if you think, that they will not serve the purpose of conducting the information that you want to share with this chart. In other situation, you can be very explicit defining all attributes, relations and cardinalities if the problem domain is small and chart can be explicit. With UML class diagram you can create a documentation or design artifact, that will be better that 100 words and better than code. Because of ease of use UML class diagram can be used as a bridge communicating complex designs to a non technical users, stakeholders.

When to use ✔️

  • ✔️ Designing system architecture
  • ✔️ Documenting the system architecture
  • ✔️ Database schema design
  • ✔️ Identifying relationships
  • ✔️ Planning refactoring

When to avoid ❌

  • ❌ Describing dynamic behavior
  • ❌ Describing processes
  • ❌ Network topology
  • ❌ Large systems
  • ❌ Event driven designs

Code form the charts:

export class Customer { constructor( public customerId: number, public name: string ) {} } export interface Order { orderId: number, totalAmount: number, customer: Customer } export abstract class BaseOrder implements Order { constructor( public orderId: number, public totalAmount: number, public customer: Customer ) {} } export class BookOrder extends BaseOrder { constructor( orderId: number, totalAmount: number, customer: Customer, private isbn: string ) { super(orderId, totalAmount, customer); } } export class Employee { private name: string; constructor(employeeId: number, name: string) { this.name = name; } processOrder(order: Order): void {} } export class Department { constructor( employees: Employee[] ) {} } export class OrganizationalStructure { constructor( departments: Department[] ) {} }
Related Posts
© 2025 buzzchart.info