Tool Mentor: Reverse-Engineering Code Using Rational Rose
This tool mentor describes Rational Rose's ability to reverse-engineer various types of elements into a Rose model.
Tool: Rational Rose
Relationships
Main Description

Overview

This tool mentor describes Rational Rose's ability to reverse-engineer various types of elements into a Rose model, including elements as varied as language source and binary code, Type Libraries, Web-based elements,  XML DTDs, and database schemas.

Reverse engineering is the process of examining an existing resource, recovering information about its design, then using that information to generate or update a model representing the project's logical structure. It enables you to reuse elements common to more than one model or system. It also enables you to iteratively develop (round trip) a system through analysis and design in Rational Rose, generating source code from the model, developing the source, then reverse engineering the source back into a Rose model.

The following Rational Rose add-ins provide reverse engineering features:

Visual C++

Rational Rose Visual C++ enables you to reverse-engineer Visual C++ source code. Its features include: 

  • Full reverse engineering of common Visual C++ language constructs such as relationships, typedefs, enums, message/object/COM maps, constructors, and destructors 
  • Dialog-based support for reverse engineering code for Visual C++ elements
  • Autosynchronization mode for automatically updating code or model when either is changed
  • 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 update and subsequently evolve a Rose model from changes in the Visual Basic source code. The extensible and customizable dialog-based tools guide you smoothly through the process of updating the model when the source code is changed.

Features include:

  • Update of model elements from changes in the corresponding source code projects
  • Synchronization mode for updating model elements when source code is deleted
  • Import of type libraries in the model 
  • Ability to automate and extend round-trip engineering by using the Rose Visual Studio RTE Extensibility

Type Library Importer

The Type Library Importer in Rational Rose enables you to import a type library of a COM component (.dll, .exe, .ocx, .olb, and .tlb files) into a Rose model. The type library is represented as a component and as a logical package in the model. The logical package contains the type library items that are defined by the type information of the imported COM component, such as co-classes, interfaces, and so forth. Each item is represented by a class.

By importing type libraries into a model, you can show how classes in the model use, implement, or depend upon classes and interfaces in other COM components, regardless of their implementation language. Features of the Type Library Importer include the following:

  • Dialog-based support for control of the Type Library Importer
  • Quick Import mode to import class placeholders and Full import mode to import classes with all operations and properties
  • Presentation of type libraries in the Object Browser or the OLE/COM Viewer in Visual Studio
  • Ability to extend and customize type library import by running the Type Library Importer from a script or a program using the Rose Visual Studio RTE Extensibility

helpbook icon The way you use a type library varies from one programming language to another. For more information, see the online help for Rational Rose and the documentation for the language add-in you're using.

 ANSI C++

The Rational Rose ANSI C++ add-in enables you to reverse-engineer source code into a Rose model. ANSI C++ supports both reverse engineering into an empty model, where new model elements are created, and reverse engineering into an existing model, where model elements are changed to correspond to the code. It provides: 

  • Support for Model evolution from analysis to design
  • Support for C++ language without being restricted to a single vendor's C++ compiler
  • 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

Rose J (Java)

Rational Rose J enables you to reverse-engineer existing Java elements into a Rose model. These elements include:

  • Source files (.java files)
  • Bytecode files (.class files)
  • Java archive files (.zip, .cab, .jar, and .war files)
  • Java Enterprise JavaBeans
  • Java Servlets

Rational Rose J also supports integration with IBM's VisualAge for Java.

CORBA 

Rational Rose CORBA enables you to reverse engineer any CORBA-compliant IDL code into a Rose model. Each reverse-engineered .idl file becomes a component, and is placed in the component view of the model.

When you reverse engineer previously forward-engineered IDL code (that is, code that was generated from CORBA model elements), your original model elements remain unchanged, except that new information or changes you entered into the IDL code are carried back into the model. The exceptions to this rule are the special cases of Rational Rose constructs that are used for one-time forward engineering only.

 XML DTD

Rational Rose XML DTD (eXtensible Markup Language Document Type Definition) reverse engineers an XML DTD (.dtd file) to create a Rose class diagram showing the structure, elements, and relationships in the DTD. You can add and remove XML DTD elements, and change relationships between the elements in the class diagram created by the reverse engineering process. After you use the Rose XML DTD syntax checker to validate the XML, you can generate a new DTD from the Rose class diagram.

Rational Rose XML DTD provides stereotyped classes you can use to model and generate an XML DTD.

Web Modeler

Rational Rose Web Modeler parses Active Server Page (ASP), Java Server Page (JSP), and HTML files in your Web application creating a web application model using stereotype classes that represent client pages, server pages, and HTML forms. You can modify the Web application model and generate .asp, .jsp, .html, and .htm files from Web Modeler.

Data Modeler

Rational Rose Data Modeler features allow the database designer and the software developer to communicate requirements using the same tool. As a database designer or developer, you can use Rose Data Modeler to model and design a database by reverse engineering an existing database schema or DDL script.

Using the Rational Rose Data Modeler Reverse Engineering Wizard, you can engineer a DDL script or database schema for an ANSI  SQL 92 standard database or the following DBMSes:

  • DB2 DBMS versions MVS and UDB
  • Oracle DBMS 
  • SQL Server DBMS 
  • Sybase Adaptive Server 

The Reverse Engineering Wizard reads the database schema or DDL file and creates a data model diagram that includes the names of all quoted identifier entities. Depending on the DBMS, Rose Data Modeler Reverse Engineering Wizard models tables,  relationships between tables, stored procedures, indexes, and triggers in the data model diagram.

In the data model diagram, you can add tables, define relationships, indexes, and domains, and apply third normal form to the elements, then transform the data model to an object model or forward engineer the data model to generate a DDL script or database schema.