UML Best Practice: 5 rules for better UML diagrams

Following these 5 rules will make your UML diagrams easier to understand, cleaner, and more consistent.

Although that has no effect on the actual model, it will improve the communication with the stakeholders.

Rule 1: Less is more

Large diagrams containing heaps of elements actually convey less information then small focussed diagrams.
When reading such a large diagram your audience will not know what to focus on, and since there’s too much on there to actually pay attention to all elements, they will quickly give up trying altogether.

Show up with a diagram like this at your stakeholder, and you will have already lost his/her attention even before you start talking.

The diagram above is a good indication of how much, or how little, you should put on a diagram. My rule of thumb is that you need to be able to print the diagram on a single A4 sheet while keeping things readable.

Rule 2: No Crossings

This is a fairly common and well known rule. Try to avoid any two lines in your diagram to cross each other.

Uncrossing lines in your diagram sure make it more readable and understandable, but there’s more to it then that.  If you are unable to uncross the lines on your diagram then that is a sign that

  • a) there’s too much on the diagram (see rule 1 Less is more)
    It might be that you are showing two different aspects of the model in one diagram. In that case it might be better to create two different diagrams, each focused on one aspect.
  • b) there is some kind of design flaw in your model
    For some reason well designed models don’t have the crossing lines problem. I have no idea why or what it is exactly, I just noticed that a lot of the times, when I’m unable to “uncross” all the lines in a diagram, I discover a design flaw that, when fixed results in a diagram without crossing lines.
The following diagram contains exactly the same information, but has just been ordered differently as to make sure there are no crossing lines.

Rule 3: Orthogonality

It seems like a small thing, but making the lines in a diagram go only horizontal or vertical, and having all only right angles makes a diagram look better instantly.

The diagram below is uses a direct style for its connectors. they all go directly from one element to the other with a straight line.

The mere fact that the lines have all kinds of angles makes the diagram look a lot messier, and less understandable.

Below here again the same diagram, but now with all connectors styles set to orthogonal.

Exceptions to this rule are (for me) note links and all relations with use cases. For some reason they look better with a direct style.

Rule 4: Parents Up

When drawing generalization or realization hierarchies on a diagram always make sure the parent elements are higher then the child elements so the arrows always point upwards.

This rule is pretty intuitive for most UML modelers. Only now and then I encounter diagrams that don’t follow this rule and have their hierarchies upside down.

Diagrams like this, where the generalization arrows point downwards are harder to read. For some reason it takes a greater mental effort to understand this then when the arrows all point upwards.

In case you have multiple elements all descending from the same parent, it is recommendable to show the hierarchy in a vertical tree style.

Rule 5: Tidy Up

I realize this sound like a nagging mom, but for crying out loud: Tidy Up!

If you want to convey the message that your analysis is a well thought trough construction that will solve your stakeholders problems then you better show up with a nice and clean diagram.

When tidying up think about

  • Aligning elements, either by one of their sides (e.g Top) or by their centers. The latter works best when aligning vertically
  • Make elements the same size where possible

After tidying up the diagram looks a loot better

Now remember, following these diagramming rules will not make you a better analyst, nor will it result in better UML models.

But it will allow you to make a better impression when trying explain the fruits of your hard labor to your stakeholders. You will need less time explaining diagrams, and you will be able to spend more time focusing on the actual content.

Other UML best practices

Categories: UML Tags: , , ,

EA Navigator is now an official Sparx Systems 3rd party add-in

I’m proud to announce that the EA Navigator has made the “official” Sparx Systems 3rd party add-in list.

Sparx Systems doesn’t just publish any add-in for Enterprise Architect. Each add-in on the list has been demonstrated to the the people of Sparx, and only if they approve it it will be added to the list.

So a couple of week ago I had an appointment to do a web conference with Sparx to do a little demo of my add-in.

Now they have approved it and the part about the EA Navigator has been published, and it even has its own url for direct navigation: http://www.sparxsystems.com/products/3rdparty.html#EAnavigator.

This is how it looks like:

Tutorial: How to change the color of inactive selected items in Windows 7

Since I upgraded to a Windows 7 machine I had a problem seeing which element was selected in my Enterprise Architect project browser.

Not when it was selected and active (dark-blue), but when I went on to work on something in a diagram.

The standard “inactive selection color” of Windows 7 is just too faint.

To illustrate that, look at the picture on the left and try to figure out which element is actually selected.

Well, if you look really carefully you’ll notice that the background of “Primitive1″ is actually just the slightest bit darker then the rest of the background.

When I first noticed this I tried to fix it by changing my monitor settings, but no amount of brightness, contrast  or color balance changes made the selection more visible without messing up everything else.

So then I started googling and I soon found the solution:

  • Select Start|Control Panel|Change the Theme
  • Once there choose Window Color
  • And Advanced appearance settings…
  • Then choose 3D objects as item and click on the dropdown for Color 1:  and click on Other…
  • Here you move the triangle on the right just a few nudges down
  • Now OK and Apply and wait until Windows has applied the settings.
  • Now check the inactive selection color again in EA. If all is well it should now look like this:
  • To be sure that you don’t loose this setting you can save your theme in the personalization window.

EA Navigator 2.1 released

With the current release 2.1 the EA Navigator has now matured into a real product that will make the life of any Enterprise Architect user a lot easier.
I can know, as it’s primary user I use it constantly during my daily modelling tasks, and I can assure you that it has already saved me heaps of time.

And because any real product should have a logo, so I proudly present to you: The EA navigator logo.

After the complete re-factoring  of version 2.0 version 2.1 has been more about polishing and refining. I’v been using my own user feedback to enhance the existing features, and add the features I was missing.

One of the things I’ve been focusing on  is the bi-directionality of all navigate features. So if I can navigate from an operation to the sequence diagrams that use it, then I also want to be able to navigate from that sequence diagram back to the operations it shows.

What’s new in EA Navigator 2.1

New and improved icons

Most of the icons used in the navigator window have gotten an update. The folder icons now already show what kind of elements can be found here.

Tagged values

In Enterprise Architect you can define “RefGUID” style tagged values is you want to link an element to another element (see EA Manual for more information).
This is a flexible way to add your own customized relations to the model.

All tagged values of a class are being examined. If their value is a reference to another element they will show up in the navigator:

Referencing Tagged Values

The referencing tagged values allow for navigation in the other direction. It will show all RefGUID style tagged values that reference the selected element.
This feature is available for all types of elements.

Owner

The owner feature simply allows to navigate further to the owner of the element. This feature is available for all types of elements.

The owner feature is a bit special as it doesn’t have a folder that you have to open, but it shows directly under the selected element.

Sequence diagram operations

Starting from a sequence diagram you can now quickly navigate to all operations called on the diagram. This sequence diagram

shows up like this in the EA Navigator window

Other changes

  • Attribute Type
    The attribute type’s behavior has been changed to show without a containing folder, just like the owner feature.
  • Relationship select
    Relationships can now also be selected. Selecting a Relationship will select it’s source, except for sequence diagram messages, they open their sequence diagram when double-clicked.
  • Number of items in window
    The number of items retained in the navigator window has been increased to 50.
  • Implementation to operation
    From a Behavior (Interaction, Statemachine or Activity) or from a diagram contained by such an element can be navigated to the operation it is implementing.
  • Add/Remove programs Icon 
    The EA Navigator now has its own icon that shows up in the add/remove programs, to easily identify the add-in among all other installed programs.

Downloads

More Information

More information about the EA Navigator add-in for Enterprise Architect can be found here:

The best feature was not intended

One of my hobbies is working on my own open source project, the EA Navigator, an add-in for Sparx Systems Enterprise Architect.

In the release 2.0 I added a graphical user interface as a docked window in EA to make it more user friendly to navigate.
The selected element is put into a treeview with each menu option as a subnode.

Getting the navigation options this way is indeed a lot easier then having to right click, and select the correct menu option.

It also saves some clicks because it doesn’t show any popup windows that need closing.

So I promptly installed the new Navigator on my office machine and started using it throughout the day.

After half a day using the new docked Navigator window I realized that the best feature of this whole Navigator add-in was one that I didn’t plan for.

Sure, being able to navigate between all those different things is useful, but the sole fact that it keeps a history of elements I was working on is something I’ve used a lot more.

Usually when you are working on a diagram, or an operation, or an attribute, you quickly need to check on how exactly those classes are named, or what exactly the multiplicity of that association was.
The annoying thing about that is that you always lose the thing you were working on, and it takes an effort to go back to that one operation or attribute.

Now with the EA Navigator I can simply scroll down and double-click on the element I was working on before as it keeps the last 20 elements in the tree.

This “history” feature was never intended, but it is definitely the best feature of them all.

EA Navigator 2.0 released

Attention! A more recent version of the EA Navigator is currently available.
See EA Navigator Downloads

I’ve just released the first “major” upgrade to the EA Navigator add in.

In this release no additional features have been added, the only thing that was changed is that the EA Navigator will now use a docked window in EA to navigate between the different elements.

Now instead of having to right-click and choose an option from the Extensions|Navigate context menu, the Navigator window will immediately show the options for the currently selected element.

In order to show this window select the option Extensions|Add-In Windows

This will show the EA Navigator control in a window you can dock anywhere in the application.

Now all you need to do to select an item in the project browser is double-click it.

The EA Navigator window retains the last 20 elements, so you can easily find the element you were working on just before.

Downloads

More Information

More information about the EA Navigator add-in for Enterprise Architect can be found here:

Select a model element from its node path (FQN) with EA Navigator 1.3

Attention! A more recent version of the EA Navigator is currently available.
See EA Navigator Downloads

Enterprise Architect has the nice feature that you can copy the node path of almost everything in the model to your clipboard.

For this example that would copy the string Model.Package2.Class1.testAttribute to the clipboard.
I use this feature a lot in say analysis documents, emails to other EA users etc… and for a model as small is this, the other user can easily identify the element I’m referring too.

For larger models however, finding the element based on the fully qualifed name (FQN) can prove to be quite the task, and unfortunately EA doesn’t provide a function to find the damn thing based on its FQN.

So I decided to add that feature to the my EA Navigator add in.

All you need to do is copy the Node Path into your clipboard and choose the option “To FQN”

The add in will then select the item in the project browser.

Downloads

More Information

More information about the EA Navigator add-in for Enterprise Architect can be found here:

Follow

Get every new post delivered to your Inbox.

Join 129 other followers