UML Modeling for C++ with UModel

C++ is one of the most powerful and efficient programming languages available, the de facto choice for high-performance computing, server applications, and complex architectures that demand the most powerful language constructs. The Unified Modeling Language™ (UML®) is the standard to design, visualize, and document models of software systems implemented in C++ and other source code languages.

Altova UModel competes with even the most advanced UML modeling tools with complete code engineering support in UML modeling for C++. UModel includes: C++ code generation from UML diagrams, reverse engineering C++ code to generate UML models, and round-trip engineering to update revisions to either C++ code and UML models.

Model transformation even lets developers convert an existing UML model designed for Java, C#, or Visual Basic to support C++.

Developers can get started with UML for C++ in UModel in several ways:

  • Create a new UModel project and choose C++ as the target code language
  • Import code from an existing C++ project to create a new UML model
  • Transform existing UML diagram to C++
  • Open an example C++ project included with UModel

UModel includes a sample home banking project implemented for Java or C#, as a business process model, and even a SysML version. We transformed the C# version to target C++ and saved the result as a new project.

The bank project includes a hierarchy of classes for various bank account types, as seen in this class diagram from the transformed project:

UML modeling for C++ original class diagram

A developer might be assigned to extend the banking application to support a brokerage account. We can easily add the new class directly to the existing diagram as shown below. (Some existing classes are collapsed simply to save space.)

UML modeling for C++ revised class diagram in a UModel project

In the class diagrams above, UModel icons graphically indicate the visibility features of properties and operations that can be protected, public, or private. If you prefer, you may also apply traditional UML-styles characters: #, +, etc.

Traditional style UML class in project for UML modeling for C++

Our only remaining task is to assign a code file name in the properties window for the new BrokerageAccount class:

Code generation is initiated from the main Project menu, opening a dialog to set a few preferences.

UModel code generation options in UML modeling for C++ projects

UModel can generate C++ code from UML diagrams compatible with versions C++ 98, C++ 11, or C++ 14, and create a project for Visual Studio versions 6.0 through Visual Studio 2017. The Message window will indicate successful code generation. Here is a partial view of the C++ source code for our new class:

UModel generated source code for UML Modeling for C++

The UModel Help file includes detailed instructions to set up your own UML C++ project. Or, if you want to jump right into a more complex example, a UML model for a real-world heating/air conditioning state machine implemented for C++ is also included.

UModel state machine diagram in UML modeling for C++ example project

UModel is the affordable UML tool that combines a rich visual interface with high-end functionality including database and XML modeling, XMI model interchange, support for Business Process Modeling, documentation generation, teamwork support, and more, to give development teams a powerful tool for today’s project challenges.

Download a free trial to jump start your own project in UML for C++!

Tags: , , , ,