UML Conventions

General conventions used for UML diagrams

In UML, Various conventions are used to identify the diagram entities and to represent the relation between two or more entities. Commonly used conventions in various UML diagrams are listed below.

Class Diagram Conventions

Class Diagram conventions can also be used for Object Diagrams

Class Entity Conventions


classDiagram
class Shape{
    <<interface>>
    noOfVertices
    draw()
}
class Color{
    <<enumeration>>
    RED_PILL
    BLUE_PILL
}
class Database{
    <<abstract>>
    +name
    +connect() Session
}
class BankAccount{
    +String owner
    +deposit(amount)
    +balance() Bigdecimal
}
  • Shape is an Interface.
  • Color is an Enumeration.
  • Database is an Abstract Class.
  • BankAccount is a Class.

Class Entity Relation Conventions


classDiagram
  ClassA --|> ClassB : Inheritance
  ClassC --* ClassD : Composition
  ClassE --o ClassF : Aggregation
  ClassG --> ClassH : Association
  ClassI -- ClassJ : Link(Solid)
  ClassK ..> ClassL : Dependency
  ClassM ..|> ClassN : Realization
  ClassO .. ClassP : Link(Dashed)


  • Inheritance: ClassA Inherits ClassB. ClassB is a ClassA.
  • Composition: ClassC has an Instance of ClassD. ClassD cannot exist without ClassC.
  • Aggregation: ClassF has an Instance of ClassE. ClassE can exist without ClassF.
  • Association: ClassG can call ClassH. But ClassH cannot call ClassG.
  • Link(Solid): ClassI and ClassJ can call each other.
  • Dependency: ClassK is dependent on ClassL. Changes in structure or behavior of ClassL effects ClassK.
  • Realization: ClassM implements ClassN. ClassN specifies and ClassM implements.
  • Link(Dashed): ClassO uses interface ClassP.

Sequence Diagram Conventions

Sequency Entity Conventions

Sequence diagrams, commonly used by developers, model the interactions between objects in a single use case.

  • A lifeline notation with an actor element symbol is used when the particular sequence diagram is owned by a use case.

sequenceDiagram
  actor User
  Note right of User: User Lifeline

  • A lifeline with an entity element represents system data

sequenceDiagram
  participant objectA
  Note right of objectA: System Entity Lifeline

Sequency Dynamics Conventions

  • objectA calls getUser() of objectB and objectB responds with user to objectA.

sequenceDiagram
  objectA->>+objectB: getUser()
  objectB-->>-objectA: user

Subscribe For More Content