C/C++ UML Support

This is the main page for C/C++ UML support.

Please place plans, proposals, discussions and other related materials here.

First version of specification for C/C++ UML project development will be placed here in a few days.


Project "UML для С/С++ for NetBeans 6.1" includes:

  1. Documented planning, architectural and design documentation, and plan for integration with code base (all in English and published at NB wiki)
  2. Following the NB community process:
    1. Contributor Agreement sign off
    2. All documentation supported in and reviewed by Sun and NB community
    3. All work items are associated with an "IZ" in Issuezilla
    4. Code is based on NetBeans 6.1 code line and maintained in NB Mercurial VCS, and updated on weekly or more frequent basis
    5. Functionality shall be isolated in a separate module(s) that can be downloaded and activated by user using standard NB mechanisms
    6. Project is completed once it meets all the quality criteria, reviewed and accepted by Sun and the module(s) included to NetBeans distribution (full one and specialized C++ one)
  3. Functionality and look and feel should be consistent with existing Java UML functionality:
    1. forward and reverse engineering
    2. support of 8 diagram types
    3. customized code generation
  4. UML should use NetBeans С++ code model. In case if code model service is not enough to serve UML needs, then code model or ANTLR or/and C++ grammar used for C++ pack should be modified and integrated back to C++ pack. This modification may be performed by Sun or SPb State.
  5. Functionality is assumed to include:
    1. Autodetection of project type and switching to C++ code generation if C++ project detected
    2. Convertion of C++ code model to UML model, and UML diagrams generation as it is done for Java
    3. С++ customizable code templates and code generation based on them
    4. Creation of UML diagrams and code templates for most popular design patterns
 Detailed list of work items along with schedule is a part of the project. It is to be created by SPb State and approved by Sun
  1. Project is reviewed on monthly basis. Face-to-face meeting (with phone bridge if necessary) are used to facilitate the review.
  2. Preliminary time frame for the project is: Feb-Aug 2008

Sun colleagues are welcome to place your comments, suggestions

--VladimirSafonov, Feb 17, 2008



By Vladimir O. Safonov,
St. Petersburg University (SPBU)

Version 2.0
March 12, 2008

1. Project requirements and goals

This version of the design document takes into account all remarks by Sun to the first version. The goal of the project is to implement UML support for C++ in the NetBeans 6.1 IDE, C / C++ development pack (CND).

1.1. Conformance to UML for Java support

The implementation should follow the style, architecture and user interface design (look-and-feel) of already existing implementation of UML for Java in the NetBeans IDE, and should maximally reuse the existing UML for Java code components (from main/uml.* modules), in particular, the code for Reverse Engineering functionality.
Implementation should support:
- Auto-detection of project type when generating code by UML model, and switching to C++ code generation if C++ project detected
- Generating C++ code from UML models (forward engineering) and generating UML model from C++ code (reverse engineering)
- Conversion of C++ code model to UML model, and UML diagrams generation, similar to how it is done for Java
- С++ customizable code templates and code generation based on them
- Creation of UML diagrams and code templates for most popular design patterns
- The same eight types of UML diagrams that are supported by the current implementation of UML for Java:
• activity diagrams
• class diagrams
• collaboration diagrams
• component diagrams
• deployment diagrams
• sequence diagrams
• state diagrams
• use case diagrams

1.2. Integration to code versioning and issue tracking system

The code to be developed, as part of NetBeans 6.1 development version, should be integrated into the Mercurial versioning system repository of the NetBeans project. The working plan for the project should be mapped to IssueZilla, to track all working milestones, their status, time frames, and related issues, and reflect all working discussions on the project.

1.3. Conformance to NetBeans architecture and reuse of C/C++ Pack and UML for Java modules

The implementation should be developed as set of NetBeans modules, to be deployed using common NetBeans module deployment mechanisms. The code should be part of the main/contrib subdirectory in the Mercurial repository. The name of the main module of the implementation should be cnd.uml.
At forward engineering stage, as the basis for generator of UML model metadata, the implementation should use CND’s С++ code model. Surely the mapping between the C++ source and C++ Code Model is enabled by the C/C++ Pack, so our implementation can assume the C++ Code Model is constructed. If necessary for the purpose of the project, C++ code model should be enhanced and integrated back into CND, by Sun or SPBU.
At reverse engineering stage, the implementation should reuse the language-agnostic, template-based source code generation from UML model using Freemarker templates for C++ code (similar to how it is implemented for Java) The templates should be developed as part of the implementation.
Also, as part of reverse engineering stage, C++ code generation helpers should be developed (similar to how it is done for Java). Another general use component to be reused in the implementation is the Source Merger that enables merging the generated and the existing source code entered by the users. As an input to the Merger, C++ Source Model should be developed as part of the project.

1.4. Time frame

The duration of the project is since February till August 2008.

2. Architecture

The general scheme of UML for C++ implementation architecture is depicted in the figure below.

In the figure above, rectangles denote code modules. Ovals denote various representations of C++ programs – as C++ source code, the corresponding C++ code model, C++ code templates, C++ source model for the Source Merger, and UML model. Red shapes indicate what needs to be developed during the project. Black shapes denote the code and structures that already exist in NetBeans 6.1 implementation and will be reused in our project, - in particular: C++ code model API; UML model API; modules to generate UML diagrams from UML model (metadata); the language-agnostic Freemarker template-based UML code generator; the Source Merger. The dashed line depicts mapping C++ source to its Code Model (at forward engineering stage), enabled by means of C/C++ Pack.

The general idea is that the implementation of the project should be relatively high-level, in the sense that it will primarily work with high-level intermediate representations of C++ programs – C++ code model, part of C/C++ Pack; the existing CND’s UML model, to be generated as the result of the traversal of C++ code model by the C++ to UML metadata generator to be developed.

The most difficult part of the project, keeping in mind the experience shared by the UML for Java team, and the complicated nature of C++, is expected to be C++ code templates, C++ code generation helpers, and C++ source model for the Merger (reverse engineering).

It is not realistic at this early stage of development to design all modules to be developed at the API details level (classes / methods, arguments, exceptions, etc.), keeping in mind the multi-layered and complicated nature of the existing NetBeans UML for Java and C/C++ Pack implementation. So we include into the project plan the specific milestones aimed to work out detailed design documents for the appropriate parts of our implementation. These design documents, as well as this one, will be coordinated to Sun and corrected or enhanced promptly if needed.

3. Project plan

The plan below is a preliminary version. It needs to be coordinated to Sun and may be corrected (after Sun’s approval) during the project development. The plan consists of seven milestones. The time frame of each milestone is one month. The comments to each milestone characterize the most complicated parts of the project, and our needs to coordinate to the C/C++ Pack team and the UML for Java team during the appropriate stage. The results of each milestone will be presented to Sun at the end of each month and discussed with Sun during our monthly meetings. All the code changes and enhancements will be promptly (once a week or faster) pushed to the Mercurial repository of NetBeans 6.1.

Milestone 1. Design document and project plan development.

Result: Design document and project plan
Comment: This milestone is already done. What we need now (in parallel to performing the 2nd milestone) is to coordinate the initial design document to Sun, correct if needed, and get Sun’s approval.

Milestone 2. Design of C++ to UML metadata generator, development of its prototype

End date: March 31, 2008.
Result: Detailed design document on C++ to UML metadata generator; prototype of C++

           to UML metadata generator supporting C++ classes only. 

Comment: At this stage, a lot of coordination with C/C++ Pack team will be needed. We’ll need to determine to what extent the existing C++ code model is suitable for the purposes of our project. The result should be detailed design of the forward engineering part of the project implementation, and the code prototype.

Milestone 3. – Implementation of C++ to UML metadata generator.

End date: April 2008.
Result: Implementation code of C++ to UML metadata generator.
Comment: This stage will also require extensive coordination with the C/C++ pack team.

Milestone 4. Design of C++ code templates, C++ code generation helpers (for UML Code Generator), and C++ source model (for the Source Merger), and development their prototypes supporting C++ classes only.

End date: May 2008.
Result: Detailed design document on C++ code templates and C++ code generator, and their prototypes code supporting C++ classes only.
Comment: The most complicated task at this stage is to determine to what extent the

 correspondence of UML and C++ is adequate or not. At this stage we’ll have a chance to  
 investigate it in detail, resulting in design of all necessary C++ code templates for C++ code 
 generation from UML model.

Milestone 5. Implementation of C++ customizable code templates and C++ code generation helpers (for the CG).

End date: June 2008.
Result: Implementation code of C++ customizable code templates, and C++ code generation helpers.
Comment: Same as for Milestone 4.

Milestone 6. Implementation of C++ source model (for Merger).

End date: July 2008.
Result: Implementation code of C++ source model.
Comment: This milestone, as well as two previous ones, is expected to be the most complicated.

Milestone 7. Implementation of automated C++ project detection. System testing. Integration to NetBeans 6.1 release.

End date: August 2008.
Result: Working implementation of UML for C++ support as part of NetBeans 6.1 release.
Comment: As the result of this stage, the implementation code will be ready (including automated detection of the project type when generating code from UML model), tested, and integrated into NetBeans 6.1 release.

Testing strategy

The strategy of testing will be based on comparison to UML for Java implementation:
- For testing forward engineering stage, similar Java code (if possible) will be developed for each C++ test (source code), and the result of our C++ / UML model generator will be compared to that of Java / UML code generator.
- For testing backward engineering stage, the UML model constructs will be converted first to C++ code (using reverse engineering part of our implementation), and then to Java source code (using reverse engineering part of UML for Java implementation). The resulting C++ and Java code will be compared.
I don’t think it will be realistic to develop automated test harnesses for such comparison, but at least visual comparison will be used.

Build procedures and build schedule

The build procedures and build schedule of our project will follow the general discipline of build procedures and build schedule of the whole NetBeans 6.1 release development project.


Prof. Vladimir Safonov – scientific advisor and technical lead of the project; design;
Part-time engineer Grigory Fedukovich – implementation
The engineering responsibilities may be reassigned by the project lead.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo