I am a fan of PlantUML; it is accessible, easy to use and you produce nice looking diagrams with minimal effort in a short period of time. The PlantUML script can be published and made available for collaboration.
The problem however it that the PlantUML script used to generate the diagrams are discrete declarations of behaviour. Validation and alignment against the Domain and or Enterprise landscape would typically be manual and the likely outcome would be model divergence.
The cost savings from the speedy delivery of fit for purpose models is long forgotten when the time comes to make changes.
I do believe there is a middle ground.. where Enterprise and Delivery teams operating at differing speeds can effectively work together. The solution centres around the ability to exchange models between the modelling platform and the script based diagraming tools.
Enterprise Architect does offer a number of methods for model exchange. The simplest being CSV imports, for high order elements, through to XMI import/export for full element, association and diagrams objects.
PlantUML does support XMI export, however at this point it only applies to Class diagrams.
So one solution to close this gap, I have cobbled together a VBScript to run with Enterprise Architect to allow a modeller to Generate a Sequence Diagram using a PlantUML script..
The following screen shot provide an example of what functionality is offered by the scripts.
- participant types of actor, control, boundary, entity and database
- boxing timeline elements
- color coding using either #RGB or HTML standard colors
- synchronous, asynchronous, return and message to self flows
- message grouping (alt, loop, critical etc)
- activate and deactivate of timelines
- return value and parameters
Sample PlantUML Script
Actor Schedular as S
Box System #lightgreen
S ->> Job: before trigger()
loop process back log
Else job in queue
S ->> Job: trigger1()
Else after 1 hour
S ->> Job: trigger2()
Alt waiting over 2 hours
Else after 3 hours
S ->> Job: trigger3()
Job -> widget: do something
widget –>> Job: return
Job -> Job: process it
S ->> Job: trigger4()
Else after 4 hours
S ->> Job: trigger5()
S ->> Job: after trigger()
PlantUML Sequence Diagram
The following steps outline the process of creating the sequence diagram within EA:
- create a new sequence diagram
- add a note element and paste the desired plantUML script into it
- right click the Note element and select “Create Sequence Diagram via PlantUML”
- the following diagram is created
EA’s does have some restrictions on the way the flows can be laid out using the API.. and this is especially evident when using nested InteractionFragments. So please check the produced diagram to ensure correct flow placement.
The following features will be added overtime.
- header and footer
- coloring of the flows & activations
- dialogue box to select PlantUML script from file the source repository or confluence page
Source code can be found at https://github.com/gobravedave/Enterprise-Architect
Download the collection of vbs files
In the scripting window with EA
- Create a new Diagram Scripting Group and name it “PlantUML“
- Create a new VBScripts and name it “Create Sequence Diagram via PlantUML“
- Cope and paste the contents of the file downloaded
- Creates a new Normal Scripting Group and name it “Common“
- Create a VBScript for each of the following vbs files downloaded:
Note.. Script names are case sensitive.
Interested in your thoughts, recommendation and in the spirt of collaboration, I am more than happy if you want to check out the scripts and make any necessary updates.