Agile Zone is brought to you in partnership with:

I am a programmer and architect (the kind that writes code) with a focus on testing and open source; I maintain the PHPUnit_Selenium project. I believe programming is one of the hardest and most beautiful jobs in the world. Giorgio is a DZone MVB and is not an employee of DZone and has posted 638 posts at DZone. You can read more from them at their website. View Full User Profile

The best tools for writing UML diagrams

  • submit to reddit

The Unified Modelling Language (version 2, usually) is a set of semi-formal notations that can be used to express aspects of software design in a graphical way. For example, design patterns are usually explained in a textual form with the aid of Uml class and sequence diagrams.

The utility of an higher-level model over the plain source code is beyond doubt: just remember that design patterns themselves stand as an higher level of abstraction over the plain class, function and interface keywords. UML diagrams place themselves in between: the more handy diagrams I have found are the class, sequence and object one, which mimic the structure of the code (classes, methods, calls, return values), cutting away at the same time the majority of implementation details.

Thanks to models like diagrams and patterns, we can talk with fellow developers and communicate the main tenets of our design in no time; the ability of iterations over the same software component are widened by our capability to propose different designs basing on quickly written diagrams instead of code prototypes. UML diagrams are not necessarily a part of documentation, although if you keep them updated they would be an effectie way of summarizing the choices you made while coding.

Probably prototypes and diagrams can be created with the same efficiency, but diagrams and pattern usually are by far more concise and can transmit the whole set of relationships between classes at a single glance.

Big Design Up Front almost always result in a failure as the predetermined methods, fields and classes do not satisfy the scenario we progressively uncover while writing tests and integrating classes with each other. But no one said that patterns and diagrams should dictate every single line of code we will write: in engineering models are useful mostly for what they leave out, not for what they represent, as much as the statements in bold in this article are readable just because the rest of the article is not in bold.

Since I write UML diagrams for my university courses and I found myself using them over and over to communicate to my work team my ideas for web applications, I had to choose a tool to write them. If you're still awake atfer this theoretical discussion, here are the choices that work best for me.

A napkin

Back-of-the-napkin UML is a classic. You're at lunch break (it's like being under the shower) and a very clever idea hits you, thanks to your brain which is continuosly working on your recurring problems even when you're slacking off. You want to quickly tell the others what you have thought, so you grab a napkin and start writing on it before the idea slips away.

It's an emergency tool, not really good for writing (at least for the Italian napkins, which have multiple strata, each very thin), and not viable for deleting anything.

A paper sheet

I'm not talking about printed paper obviously: a blank paper sheet, along with a pencil with a sharpener, and a rubber so that you can rewrite parts of the diagrams. This combination is very handy, and no software tool will ever give you the flexibility of paper, unless you have some StarTrek-like touch screen device.

Moreover, paper prevents you from trying to maintain the diagram for more than a few days, since archiving sheets would be an hassle: you can't git add them. If you really need, you can scan the sheet.

In the Agile movement, there is a tendency on favoring low-tech tools like paper over technological tracking software, for instance in the case of user stories. This choice reflect also this influence.

A blackboard or whiteboard

Sheets do not scale to more than 2 or 3 people: a board can instead visualize a diagram so that everyone can keep it in mind during the day. For architectural diagrams, this ia manna from the sky.

A board also offers more space to juggle things around, but the total board space however is limited: other people need it, and writing on the walls won't work for long.

An electronic board with multiple pages you can save and retrieve, and writing on with some kind of device, would be very cool; we're not there yet technologically or economically. To save this kind of diagrams, I used high-resolution protographs, which can be made with a cheap point-and-click camera nowadays in some seconds. Needless to say, editing those diagrams would be impossible.

There is a big disadvantage in all the three physical tools: they require the team to be in the same location, and do not allow remote work.


Instead of tiring yourself by pulling and pushing things around, write a simple formal description with yUML of your diagram and let the yUML online tool generate it. The description is very simple; this code would generate the diagram on the right:

[Wages]^-[Salaried], [Wages]^-[Contractor]

Don't worry about what you can do with this tool, yUML supports only the kinds of diagrams which are useful, like class and activity. I miss the sequence diagram however.

Note that if your diagram is too complex to be effectively visualized by it (gets mixed up or with crossing arrows), it will be too complex for human to understand at a glance too. Yu'd probably better breaking it up in more than one diagram, or cut unneeded items. I use yUML for all the UML diagrams in my articles.

Published at DZone with permission of Giorgio Sironi, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Andrew McVeigh replied on Thu, 2010/11/18 - 7:45am

As you point out, UML is useful if you use it right.  Use it to show key relationships between things, but not so much detail that it starts to resemble visual code. A lot of the -ve backlash against UML comes from seeing people use it badly: either they draw boxes and lines with no meaning (architects ;-) or they try to show all the detailed code structures (no focus or abstraction). We've all seen both unfortunately.

In this respect, UML2 is actually a big improvement on UML1.x.  It still contains the useful core diagrams like class etc.  However, it adds the following improvements which are really worth looking into:

- real component diagrams (these were really poor in UML1)

- sequence diagrams with operators (i.e. they let you express looping easily, saving lots of work)

Component diagrams are particularly interesting. They let you express the full structure of things in your programs, in a way which emphasises the wiring between things.  i.e. no need to show the low level code structures, just the high level connections.

If you want to take a closer look at components in UML2 and how they can be used to connect up your classes, have a look at my tool:
It will give an idea into how useful component structures can actually be.


Richard Kennard replied on Fri, 2010/11/19 - 2:44am

We recently evaluated a number of UML tools in order to try and produce a really clear, helpful UML diagram of Metawidget.

We found that many tools lacked important features for clarity, such as: using straight lines with 90 degree bends and 'bridges' instead of diagonal lines; arbitrarily hiding class methods/attributes (agree with Andrew on the importance of focus); colouring different sections. In the end we settled on a combination of MagicDraw UML and PhotoShop. Even then, though, it required a lot of iterations to get the clarity we wanted.

You can see the finished result here:

Andrew McVeigh replied on Fri, 2010/11/19 - 7:45am in response to: Richard Kennard

> to try and produce a really clear, helpful UML diagram of Metawidget.

it's a great diagram -- you've really captured the totality in a way which still allows focus. it's a nice example of how UML can actually add value. i could imagine someone sticking this on a wall because (a) it looks good and (b) it is a valuable reference with useful spatial clues.

moving to the limitations of these tools - they stick too rigorously to the idea of UML as a shrine rather than UML as a useful way of describing things (possibly with graphical finesse). for instance, one of the guys in my team started making hybrid diagrams showing a mix of classes and objects in one box. he was getting across a concept and UML is too strict and not focussed enough on freeform expression.

as another example, in your diagram a possible freeform combination could be placing a small picture of signifcant widgets next to important classes. that would be really effective, i think.

Jonny Wray replied on Fri, 2010/11/19 - 4:39pm

FYI: For on-line generation of sequence diagrams using a definition language I've found web sequence diagrams useful

Richard Kennard replied on Fri, 2010/11/19 - 5:37pm


Thanks for your kind words and your great suggestion. I will see about squeezing in some thumbnails of significant widgets.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.