Contents

Plantuml Is Awesome

PlantUML is an open-source tool allowing users to create UML diagrams from a plain text language.

This post is all about why I felt PlantUML is awesome.

PlantUML is an open-source tool allowing users to create UML diagrams from a plain text language.

You can just write few lines of code to draw your UML diagram. UML diagrams are very important in communicating design implementation, doing these digrams in draw.io or something drawing tool is a time taking task. Playing with touchpad/mouse for long time is less effective.

I have used similar tools in past, like mermaid and graphviz.

Following are the things that made PlantUML different

  • Readability
  • Maintainable
  • Flexible
  • Powerful
  • Customable

Once the UML is designed with plantUML the end result can be extracted out into PNG or SVG. There are plugins that can be easily intergated into IDE’s, such as PlantUML for VS Code and PlantUML for IntelliJ.

Also available for Confluence(document manager of Atlassian suite) where the history of the change in design implementation can be tracked easily PlantUML for Confluence

PS: PlantUML has written in java with graphviz under the hood :)

PlantUML is a component that allows to quickly write :

  1. Sequence diagram
  2. Usecase diagram
  • Class diagram
  • Activity diagram (here is the legacy syntax)
  • Component diagram
  • State diagram
  • Object diagram
  • Deployment diagram beta
  • Timing diagram beta

You can find the details documentation of how and what is plantUML.

Here I took a random sequence diagram from internet and tried to replicate the same in PlantUML with few tweeks, the end result was wow!

Sample Sequence diagram

/images/posts/001-plantuml-01.png
sample sequence diagram

Sequence diagram with PlantUML

/images/posts/001-plantuml-02.jpg
sequence diagram by PlantUML

It’s not just a replica, but a much better one.

Here the code that did the magic for us.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@startuml
header Facebook Authentication System
title Facebook Authentication System
footer Page no %page% of %lastpage%

actor user #3c5a99
participant WebBrowser as "Web Browser"
box "Facebook server"
    participant App as "Application"
    participant AuthZ as "Authorization System"
    database FCS as "Facebook Content System"
end box

== Basic flow ==

activate user
user -> WebBrowser : get FB resource
    activate WebBrowser
        WebBrowser -> App : request FB access
        WebBrowser <-- App : <<http redirect>>
        WebBrowser -[#red]> AuthZ : authorize
        WebBrowser <-- AuthZ : permission form
        user <-- WebBrowser : permission form
    deactivate WebBrowser

    user -> WebBrowser : user permission
    activate WebBrowser
        WebBrowser -> AuthZ : process permission
        ... 5 minutes alter ...
        WebBrowser <-- AuthZ : <<http redirect>>

        == Authorization ==
        alt permission granted
            activate App
                group
                WebBrowser -> App : FB authorization code
                        activate AuthZ
                            App ->  AuthZ : FB authorization code
                            App <--  AuthZ : FB authorization code
                        deactivate AuthZ

                        activate FCS
                            App -> FCS : access FB user protected resource
                            App <-- FCS : user protected resource
                            note left FCS: Check with content system
                        deactivate FCS
                 end
            deactivate App

            WebBrowser <-- App : user protected resource
            deactivate WebBrowser

            user <-- WebBrowser  : user protected resource
        else permission not granted
            activate WebBrowser
                activate App
                    WebBrowser -> App : no authorization
                    WebBrowser <-- App : FB resource not available
                deactivate App
            deactivate WebBrowser

            user <-- WebBrowser  : FB resource not available
        end
    deactivate WebBrowser

deactivate user
@enduml

Thanks for reading!!! :)