PlantUML is an open-source tool allowing users to create diagrams from simple plain-text language descriptions.
Basic Diagram Blocks
@startuml
User -> Service : Authenticate
Service --> User : Token
@enduml
Class Diagrams
Class Attributes & Visibility
@startuml
class BankAccount {
+String owner
#Integer accountNumber
-Decimal balance
~String branchCode
+deposit(amount : Decimal) : void
-calculateInterest() : Decimal
{static} String bankName
{abstract} getAccountType() : String
}
@enduml
| Modifier | Visibility |
|---|---|
+ |
Public |
- |
Private |
# |
Protected |
~ |
Package Private |
Class Relationships
@startuml
Animal <|-- Dog : Extension / Inheritance
Car *-- Engine : Composition
College o-- Student : Aggregation
Driver ..> Car : Dependency
Interface <|.. Impl : Implementation (Dotted)
@enduml
| Syntax | Relationship | Meaning |
|---|---|---|
<|-- |
Generalization / Inheritance | "is a" |
*-- |
Composition | Child cannot exist without parent |
o-- |
Aggregation | Child can exist independently |
<|.. |
Realization | Implements interface |
..> |
Dependency | Transient usage |
Notes & Annotations
@startuml
class Customer
note left of Customer : Customer identity record
note "Floating standalone note" as N1
@enduml
Activity Diagrams
@startuml
start
:Receive Payment;
if (Verified?) then (yes)
:Fulfill Order;
:Send Email;
else (no)
:Notify Customer;
endif
stop
@enduml