The best tools for writing UML diagrams
The Agile Zone is brought to you in partnership with JetBrains. Learn how Agile Boards in YouTrack are designed to help teams plan, visualize and manage their work in an efficient manner, with support for both Scrum and Kanban processes.
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.
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:
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.