Tool Mentor: Generating Elements from a Model Using Rational Rose
This tool mentor describes Rational Rose's ability to generate source elements from a Rose model, enabling implementers to create and update source based on the design documented in Rose.
Tool: Rational Rose
Relationships
Related Elements
Main Description

Overview

Through its language add-ins, Rational Rose enables developers to generate code directly from a design model. As design evolves, implementers can round-trip code in an iterative process of generating code from a model, updating the source, and reverse engineering the changes back to the design model.  

The following Rational Rose add-ins provide code generation features:

Visual C++

Rational Rose Visual C++ enables you to generate Visual C++ source code from classes and components in your Rose model. Its features include:

  • Round-trip engineering Visual C++ models and code
  • Full generation of common Visual C++ language constructs, such as relationships, typedefs, enums, message/object/COM maps, constructors and destructors 
  • Dialog-based support for modeling and generating code for Visual C++ elements
  • Syntax checking
  • Autosynchronization mode for automatically updating code or model when either is changed 
  • Ability to extend and customize code generation through the COM, ATL and MFC interface libraries
  • Integration with Microsoft's Visual Studio, including IDL files
  • Support for Visual C++ template classes and user-specified code patterns

 Visual Basic

Being tightly integrated with the Microsoft Visual Basic 6.0 environment, the Rational Rose Visual Basic Language Support Add-in enables you to generate Visual Basic source code from components and classes and to visualize existing code in UML in your Rose model. The extensible and customizable dialog-based tools guide you smoothly through the process of generating code from a Rose model and updating the source code when the model is changed.

Features include:

  • Creation and specification of new Visual Basic classes in the Rose model with help of the Class Wizard
  • Creation of members in the class and specification of implementation details about the class and its members in the Model Assistant tool
  • Preview of code to be generated for each members of each class
  • Deployment of classes to components with the help of the Component Assignment tool
  • Full generation of common Visual Basic language constructs, such as constants, Declare and Event statements, Enum and Type declarations, Get, Let, and Set procedures, and user-defined collection classes from the components in your model into corresponding source projects with help of the Code Update tool
  • Synchronization mode for updating source code project items when model elements are deleted 
  • Ability to customize and extend code generation by using Visual Studio code templates and VBScript
  • Ability to automate and extend round-trip engineering and templates by using the VSRTE SDK

ANSI C++

Rose ANSI C+ is the C++ add-in for Rational Rose. It provides:

  • Support for Model evolution from analysis to design
  • Support for C++ language without being restricted to a single vendor's C++ compiler
  • Generation of C++ source code from a model
  • Round trip engineering that synchronizes models and generated C++ code across multiple iterations
  • Changes made to the code are carried back to the model during reverse engineering
  • Design, modeling and visualization of all C++ constructs including classes, templates, namespaces, inheritance and class members functions
  • Support for large frameworks
  • User controlled code generation via patterns of default constructors, destructors and class members
  • Style sheet mechanism to allow for custom formatting of generated code

Rose J (Java) 

Rational Rose J enables you to generate Java source code from classes and components in your Rose model. Its features include: 

  • Full generation of common Java language constructs, such as imports, extends, implements and throws relationships, constructors and initializers
  • Syntax checking
  • Javadoc tag generation
  • Dialog-based support for modeling and generating code for Enterprise JavaBeans and Servlets, including the JAR and WAR archive files for deploying Java 2 Enterprise Edition (J2EE) elements
  • Autosynchronization mode for automatically updating code when a model is changed
  • Ability to extend and customize code generation through the Java XFE interface
  • Integration with IBM's VisualAge for Java 
  • Built-in editor support for browsing and editing Java source code
  • Java Frameworks for adding Java API classes to a model

CORBA 

Rational Rose CORBA allows you to generate CORBA-compliant IDL code from classes and components in your Rose model. Its features include:

  • Full generation of common CORBA IDL constructs, such as const, enum, struct, union, typedef, exception, value, fixed, and interface, as defined in the CORBA 2.3 specification
  • Generation of native types, similar to CORBA fundamental types, to allow users to specify programming language-dependent types for use by object adapters
  • Syntax checking
  • Built-in editor support for browsing and editing IDL source code
  • Round-trip engineering capability that synchronizes models and generated IDL source across multiple iterations

XML DTD 

The Rational Rose XML DTD add-in provides visualization, modeling, and tools for XML documents that use document type definitions (DTD).  From the valid XML DTD model, you can use the forward engineering feature to create new XML DTDs.

By modeling your XML DTD, you can visualize the structure of the document to see which element definitions to change or remove. Since you probably don't work in isolation, you can share your XML DTD model with members of your development team to verify that you have captured the XML document requirements. 

The Rational Rose XML DTD syntax checker finds errors in the XML DTD model allowing you to make corrections before the DTD before is implemented.

To support mapping XML to UML, Rational Rose extends UML with stereotypes for XML elements, element attribute lists, entities, and notations. Stereotypes or tagged values represent XML operator symbols, sequence lists, choice lists, and element and element attribute multiplicity.