Posts

Enterprise Architect UML – Add C++ #include code statements for dependency relationship

By default #include statements are not inserted into files for dependency relationships when generating C++ code from UML models in Sparx Enterprise Architect – this is a bit annoying but we are well used to UML editors doing annoying things so at least it’s not a terrible surprise!

 

In Enterprise Architect’s defence it is quite easy to add this missing functionality. In order to get it to generate #include statements we have to edit two of the code generation templates: “Import” and “Import Section”.

 

To edit the templates go to the “Settings / Code Generation Templates…”, menu and you should see a list of the templates on the left-hand side of the screen.

 

Change the “Import” template so that it looks like this:

$file = %importFileName%
%if $file == "" or importInFile=="T" or $file == fileName%
%endTemplate%
#include "$file"

And then change the “Import Section” template so that it looks like this:

$COMMENT="WARNING: THIS IS AN ADVANCED TEMPLATE"
$COMMENT="DO NOT MODIFY UNLESS YOU ARE AN"
$COMMENT="ADVANCED USER!"
$imports += %list="Import" @separator="\n" importFromDependency=="T"%
%REMOVE_DUPLICATES($imports, "\n")%

%fileImports%

Now when you generate C++ code from your modle #include statements should be inserted to satisify dependency relationships.

 

Thanks to this article for the instructions (in German!).

 

Enterprise Architect – Show parameter names in class diagram

I don’t know what it is about UML editors but it always seem you have to spend more time fighting with them than actually successfully doing and UML modelling for the software that you’re supposed to be developing..

 

Anyway I was trying to figure out how to get Enterprise Architect to display operation parameter names in class diagrams, and it turns out that this isn’t enabled by default and to switch it on you have to go to the following menu:

 

Diagram / Properties… / Features

 

and then select ‘Full Details’ in the ‘Show Parameter Detail’ drop-down, now parameter names should be displayed in your class diagrams…

 

UML Design Package Options

I have been at software design for quite a while now and UML has been my constant companion for a good part of this time. Whenever I think of UML I think how great it is for helping with software design, but also how more or less uinversely rubbish most of the UML design applications are.

 

I have used tonnes of them, the big and expensive ones, the small funky ones and the in between ones and they all have their problems. I especially hate the ones that require at least 100 mouse clicks and popup options screens to get anything done, they are a real RSI minefield! Sometimes I think you would be better off with a pen and paper…

 

Every so often I go and on the hunt for new or improved offerings, testing them on real projects. This all takes time and I haven’t gone on such a hunt for 2 years now – So could anybody please recommend what they think is the best UML package out there at the moment and hopefully save me some time?

 

Here are some of the things I would like from a design app:

 
  • Efficient user interface, the less clunky context menus and mouse clicks the better!
  • Not tied to any particular programming language
  • Affordable (open source would be great!)
  • Standards Compliant (no renaming or reinventing of bits of the UML)
  • Easy to copy diagrams out into other documents
  • Good support for the different diagram types
 

Oh also, are there any decent cloud offerings?

 

Cheers – looking forward to hear your suggestions!