The best tools for writing UML diagrams
Join the DZone community and get the full member experience.
Join For Freethe 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.
yuml
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.
Opinions expressed by DZone contributors are their own.
Comments