I found VP quite helpful for creating UML diagrams. But sadly the C++ round trip engineering seems very limited. After two or three iterations of round trip engineering it typically fails for us and leaves the diagram and the code in a bad state.
It would be great if the C++ round trip engineering could be extended to better support common workflows.
Limitations we found in Visual Paradigm Enterprise 16.2 (in the first two hours):
- Adding the statement
= default
for the class constructor or destructor breaks the C++ parser. The class is removed from the diagram - When using a namespace, and the namespace encapsulates multiple methods in the C++ source file, VP will add duplicate methods after the namespace. So the following syntax seems not supported:
namespace myNameSpace {
myClass::myClass() {
}
myClass::~myClass() {
}
}
- The C++ parser seems to have problems when using method argument
const <type> <name>
compared to<type> const <name>
. We encountered problems for example when usingconst std::string&
. The problems went away when instead usingstd::string const&
. It would be great if both syntax could be supported because they are both very common. - The C++ parser seems to have problems with class destructors. When parsing a class that has a constructor and destructor, the UML diagram will instead show two constructors and no destructor.
- The C++ parser does not seem to respect method ordering. For example, all our classes have the contructor and destructor first (and this is very very common in C++ and Java). But when using the round trip feature to parse the C++ code, the method ordering seems to be randomized. This requires tedious re-ordering by hand.
- Sometimes the code generator duplicates arguments in the method signature of the implementation file. The method signature is correct in the header file but has duplicate arguments in the implementation file.
- Sometimes the code generator seems to completely re-generate a source file, which removes the formatting and include statements. We could not find a reason why this happened.
- There is no good support for templates for source files. It would be very helpful if further templates could be defined.
- Template for the file would help so that a common copyright header could be added by default. This could also help so that common includes (like
stdexcept
for exceptions) could be added by default. - Template for class declaration or method declarations would help so that common sections like doxygen comment blocks could be added by default.
- Template for the file would help so that a common copyright header could be added by default. This could also help so that common includes (like
- The UML diagram editor allows to generate getters and setters along with an attribute. But the code generator does not contain valid getters and setters. Since getters and setters are very simple, it would be nice if they would contain valid code.
- In C++, default getters should be const (so add a const after the method name).
- In C++, base classes need to contain virtual destructors. If this is overlooked it can lead to incorrect code (resource leaks). It would be great if VP would automatically add constructors and destructors.
- It would be nice if VP would allow to configure whether the class attributes come before or after the methods. Currently they come before the methods. In C++ it is more common to have them after the methods.
- Last, not least, when the C++ parser fails to read a class, the errors should be more visible. By default, the errors are shown only in the bottom right corner in a tiny red number on top of a letter-icon. For an important problem like “the diagram just broke” this is not a suitable visualization. If the user overlooks the error, they may save a corrupted diagram to disk.