PlantUML is a component that allows to quickly write. This is cheat sheet of PlantUML to use frequently.

Basic

Common

Notes and Comments.

keyword usage image
title Title parts_usecase
note left : Notes Left parts_usecase
note right : Notes Right parts_usecase
' Single-line Comment  
/' '/ Block Comment  

Code

title Title

( )
note left : Note

[  ]
note right : Note

' single-line comment

/'
  block comment
'/

Draw

basic_common

Participant

Participant actors.

keyword usage image
actor Actor parts_usecase
boundary Boundary parts_usecase
control Control parts_usecase
entity Entity parts_usecase
database Database parts_usecase

Code

actor Actor
boundary Boundary
control Control
entity Entity
database Database

:Actor alias:

Draw

basic_participant

Arrow

Arrow direction.

keyword usage image
-up-> Up parts_usecase
-down-> Down parts_usecase
-left-> Left parts_usecase
-right-> Right parts_usecase

Code

up -up-> right
-right-> down
-down-> left
-left-> up

Draw

basic_participant

UML

Use Case

Represent the required functions.

keyword usage image
( ) Use Case parts_usecase
-> Use parts_usecase
.> Extend, Include parts_usecase

Code

actor Promoter
actor Entrant

Promoter --> (Create Event)
Promoter -> (Attend Event)

Entrant --> (Find Event)
(Attend Event) <- Entrant

(Attend Event) <.. (Create Member)  : <<include>>

Draw

usecase_diagram

Activity

Represent the state of the process.

keyword usage image
" " Activity parts_usecase
(*) -> Initial parts_usecase
-> (*) Final parts_usecase

Code

(*) --> "Find Event"
"Find Event" -> "Attend Event"

if "Capacity?" then
  ->[ok] "Create Ticket"
else
  -->[full] if "Standby?" then
    ->[ok] "Standby Ticket"
  else
    -->[no] "Cancel Ticket"
    "Cancel Ticket" --> (*)
  endif
endif

"Create Ticket" --> ==show==
"Standby Ticket" --> ==show==
==show== --> "Show Ticket"
"Show Ticket" --> (*)

Draw

activity_diagram

State

Represent the state of the objects.

keyword usage image
[*] -> Initial parts_usecase
-> [*] Final parts_usecase

Code

[*] --> active

active -right-> inactive : disable
inactive -left-> active  : enable

inactive --> closed  : close
active --> closed  : close

closed --> [*]

Draw

state_diagram

Sequence

Represent the messages and orders of the interacts.

keyword usage image
-> Message parts_usecase
<-- Return parts_usecase

Code

actor Entrant

Entrant -> Ticket : Attend Event Request

activate Ticket
Ticket -> Member : Create Member Request

activate Member
Member -> Member : Create Member
Ticket <-- Member : Create Member Response
deactivate Member

Ticket -> Ticket : Create Ticket
Entrant <-- Ticket : Attend Event Response
deactivate Ticket

Draw

sequence_diagram

Object

Represent the logical view of the object.

keyword usage image
object Object parts_usecase
<|- Extension parts_usecase
*- Composition parts_usecase
o- Agregation parts_usecase

Code

object User
object Group
object Member

object Event
object Ticket

User . Group
User o.. Member
Group o.. Member

Group o. Event
Event o.. Ticket
Member . Ticket

Draw

object_diagram

Class

Represent the logical view of the class.

keyword usage image
class Class parts_usecase
+ Public parts_usecase
- Private parts_usecase
# Protected parts_usecase
~ Package parts_usecase

Code

class User {
  username
  password
  +sign_in()
}

class Group {
  name
}

class Member {
  roles
}

User .. Member
Group .. Member

Draw

class_diagram

Component

Represent the dependency of the components.

keyword usage image
[ ] Component parts_usecase
package Package parts_usecase
frame Frame parts_usecase
folder Folder parts_usecase
database Database parts_usecase
node Node parts_usecase
cloud Cloud parts_usecase

Code

cloud "Cloud" {
  package "Package" {
    [register]
    frame "frame" {
      [backup]
    }
  }
}

node "Node" {
  database "Database" {
    [store]
  }
  folder "Folder" {
    [File]
  }
}

[register] .. [store] : HTTP
[backup] .. [File] : FTP

Draw

component_diagram