Brief presentation: Software modelling with UML and the KDE tool Umbrello


Well protected

by Rita Ortenburger


The Unified Modeling Language is the accepted standard to model object oriented programs graphically. Using the KDE tool Umbrello you can develop various diagram shapes easily and transform them into source code parts.

The free GUI tool Umbrello[1] assists software developers to describe with diagrams the flow and architecture of a program in the Unified Modeling Language (UML,[2]). Especially during the analysis and design process at the beginning of a project the image-like descriptions help bringing together the various ideas of everyone involved in planning and realization of the project.

Matching its tasks, Umbrello shows another quality in its honesty: The good documentation (among them one in German) explicitly points out that this tool is not a magical code generator which converts the diagrams into finished applications. But it can create source modules for Java, C++ and PHP from class diagrams. The generated source contains an editable standard comment and a class including the variables and method heads together with their calling parameters which have been specified in Umbrello before.

Multiple representation

Umbrello futher supports sequence diagrams for chronological flows, state diagrams (see fig 1) for State Machines, activity diagrams, case diagrams (fig 2) as well as collaboration diagrams which show how the different application components work together. How is confronted with the task to create an application graphically in compliance to the UML standard should also look up the related specification[4] of the OMG (Object Management Group,[3]).

In umbrello the developer can place the various parts of a diagram GUI-like on the workspace easily via graphical symbols in the toolbar and by drag-and-drop. Unfortunately the refresh of the workspace (at least with the combination Umbrello, KDE 3.0.0 and QT 3.0.3) doesn't work properly: Often old lines remain visible in the diagram which disappear only after the next complete refresh.

The tree view in the left part of the window (fig. 3) shows the diagrams and elements created so far. Below the top view layer - the case-layer and the logical layer - the associated diagrams and elements on the same level in alphabetical order.

This means that Umbrello does not subsume the cases, actors and classes under each diagram which uses them, but they all are seperate structure components, which have been assigned a uniqued identifier by the system.

fig 1: UML state diagrams describe objects in various states as well as events which trigger a state change.




fig 2: The UML case diagram describes relations and dependencies between various scenarious (Use Cases) and actors. It descibes what is to do but not how it is done.




Folders organize the class tree

Probably this should prevent classes which appear in multiple diagrams from occupying space in the structure tree multiple times. The missing information about which element is used in which diagram and the missing structure might be confusing for larger projects however. Possible for later Umbrello versions might be a view menu which enables the user to switch between the current alphabetical order and a future diagram-element-hierarchy. The new viewing mode could also show orphan elements which aren't used anywhere, on the diagram layer to make the user aware of these orphans.

In order to organize the tree view better the user can insert additional folders (via the context menu »Logical view«). Such forks of the tree view, however, do not have any effect on the folder structure below the Umbrellow destination path where the tool saves the source code automatically. If modules belong to a specific subfolder, you have to enter the folder name in the properties dialogue of the classes as package name.

An element can be created at least in three ways: By clicking on an icon in right toolbar and clicking in the workspace, by using the function »New« in the popup menu (right-click in the workspace) or via the context menu in the structure tree. An existing element can, if it is compatible with the diagram, simply be dragged with the mouse from the tree view to the diagram workspace. Additionally there is the menu item »Source code | Class Wizard«. You can also use the source code menu to import existing C++ headers saving you the hassle of manually creating the class.

Labels can be changed in the properties dialogue - activated by double-clicking an element - or by single click on a component in the tree view. The latter transforms the label of the structure component into an input field.
To quit the input mode in order to go back to the pointing mode is amazingly difficult: You might expect that any click outside the text area quits the edit mode. In fact you have to confirm the change with the [Enter]-key or cancel it by pressing [Escape]. A click in the documenation window or a double click on a different structure component also quits the input mode. In these cases Umbrello discards all changes.

And when I mention documentation windows: Umbrello offers explanations in a small static window. It shows the comment of the currently selected element. Descriptions are created and changed diretly in the documenation window or via the properties dialogue. If the option "documenation comments" in the Umbrello properties is enaled the text belonging to a class also appears in the source code.

fig 3: The Umbrello window is divided into several parts: On the left the tree view, in the middle the currently respective UML diagram and on the right the icon bar.



Links of art

The art of modelling are complex prrogramming project is, among other things, to find out and visualize the relationship between the involved components coherently and according to what is needed. Therefore the tool bar contains for most diagram groups mostly icons for links (associations).

An example is the so-called generalizaiton: In a class diagram a continous line with an empty arrow head is pointing from the sub-class to its base-class. This inheritance relationship is put by Umbrello into the source code according to the language-specific syntax. The relation of the whole to a part (aggregation) is found in the sources of the class of the whole as a private variable of the type of the part.

A nice peculiarity of the graphical associations in Umbrello is revealed by double-clicking a line: In contrast to the usual way how things work in Umbrello the properties dialogue does not appear. Rather, the line gets another handle, which can be used to bend the line by drag-and-drop (fig 4). Unfortunately the Umbrello version I'm using here doesn't seem to correctly save such bent lines, because after a restart the former right-angled association stubbornly appears as straight.

Umbrello automatically finds out the starting- and ending-point of an association by counting the links. This is way a line can not be moved beyond its ending-poins along the border of the destination element. If this behaviour is desirable in every case can be doubted. After the unwanted straightening of the bended line it caused - at least in our test example - Umbrello to show two associations crossed-over all of a sudden (fig 3).

For future versions the call for an undo-function will most probably get louder. An element-specific manual after clicking on the help button in the properties dialogue would certainly also be helpful - right now only the contents page of the manual appears.




fig 4: To arrange the association lines better, Umbrello can bend the lines. To achieve this the user must divide the line by double-clicking on it.



Swapping of models

The OMG defines with XMI (XML Metadata Interchange) also an interchange format for UML-modelling data, in which Umbrello saves its diagrams. The attempt to import an XMI-Datei saved by Umbrello into the development tool Oracle JDeveloper 9i, caused an exit with the message »Unable to Parse XMI File«.

But, if you look at all the functions which couldn't be described here, ... element-depended popup menus, all those properties to controlling start options, those diagram type depended details and the plausibility checks if you link elements ..., the version number 1.1 rather seems a modest understatement


Summary

Admitted: Until Umbrello is matured to professional tool, there is still a lot to be done for the development team. Furthermore some instabilities (frozen windows, one crash) put some clouds in front of the sun. But for developers who want to get acquainted with UML and want to graphically visualize a small or medium sized programming project, the version 1.1.1 can really be recommended right now. (fjl)
Make your own free website on Tripod.com