Introduction to reverse engineering of Rational Rose

Source: Internet
Author: User
Tags data structures db2

Reverse engineering (Reverse Engineer) is the ability to generate models from the code of an existing system. The main purpose of analyzing existing code is to understand the code structure and data structure, which correspond to the model diagram is class diagram, data Model Diagram and component diagram (the description of UML various model diagrams see annotation ③), which is the result of the reverse engineering of rational rose. The reverse engineering features supported by Rational Rose are powerful, including programming languages such as C + +, VB, VC, Java, CORBA, database DDL scripts, and so on, and can be directly connected to DB2, SQL Server, Databases such as Oracle and Sybase import schemas and generate data models.

Many large-scale C + + developed products are related to the use of the database, the development of such a large system, especially in the case of two development, the main difficulty is the source code and database structure analysis. And using Rose's reverse-engineering function, can complete the code ' class diagram as well as the database schema-> data Model Diagram Transformation, solves these two difficult points, may enable the development and the design personnel in to this large-scale system upgrade, the analysis and the development, more convenient, the quick, the orderly grasps the system structure, No more headaches for analyzing the huge system structure.

C #, ASP.net, C + + programming tips for "using rational rose for C + + code and Database structure analysis": strong>cdate (expression)
The transformation expression is a date type.



Two How to use rational rose for C + + code Analysis

This section focuses on how users can generate UML models using Rose's reverse engineering and use it for structural analysis of C + + code.

Rational Rose can support the model of standard C + + and Visual C + + to code conversion and reverse engineering. The following is a detailed description of the reverse engineering steps and specific actions for both C + + project.

1. ANSI C + + (standard C + +) Reverse engineering (Reverse Engineer) uses standard C + + reverse engineering to create a component (component) in a Component diagram (component view) that sets up information about the components that need to be converted, That is, the language of the component, the files contained, the path to the file, the file suffix, and so on, and then reverse engineer can convert the code to a class diagram based on the information given.

A) Right-click the component view (Component view), select New->component, and create a new component


b) Set the component language property to ANSI C + +

① Select the created component, right-click and select Open Specification


② in this dialog box, set the component language to ANSI C + +


(c) Configure the ANSI C + + component, set up the C + + code files contained in the component, and make detailed settings for the C + + language

① Select the component, right-click, and select ANSI C++->open ANSI C + + specification


② the source file root directory where your C + + source files are located (no Chinese paths are supported), and add the files that need to be converted to project files, depending on your needs for other settings, such as: header file extensions, and so on.


  

D Convert the set of component to a model diagram

① Select the set of component, right-click, select ANSI C++->reverse Engineer


② select the class that needs to be converted, click OK, and a component reverse conversion is complete.


2. When Visual C + + uses this feature, it requires visual Studio to be installed on the user's machine at the same time. The reverse engineering of Visual C + + also requires that you first create a component and set the component language property to VC + +. Rational Rose's conversion to VC + + model is realized by reading the information of VC + + project file, and the user only needs to assign the corresponding project file information to component.

(a) Assign VC + + project information to the component that you just created.

① Select the component, right-click and select Assign to Project


② in the dialog box to find the component you just created, right-click and select Properties.


③ in the dialog box below, select project that needs to be converted, click OK, and the component is associated with project that needs to be converted.


b converting the component into a model diagram

Select the set of component, click the right button, Update Model ..., will pop up the confirmation dialog box, select the class to be converted, click Finish on it.







Three How to analyze the database structure with rational Rose

Using rational rose to design and export DDL language scripts from the relational database model, you can also import the existing DDL script generation data model and connect SQL Server, DB2, Oracle and other databases and import the database schema generation data model.

Here's an example of SQL Server to illustrate the steps of the reverse conversion project.

A) First, select Tools->data modeler-> Reverse Engineer


(b) In the process of reverse engineering conversion, you can choose whether to convert from database or DDL script, and if it is a DDL script conversion, give the location of the DDL script file directly. This example shows the process of connecting a SQL Server database to the build data model, so select the database and go to the next step.


(c) Fill in the database related information


d) Select all schemas that need to be converted


e Select which database elements you want to import into the data model


The conversion operation automatically adds a database component to the component diagram (Component view) and generates a data model in the logical diagram (Logical view) that starts with the name "Schema".


Open the data model to see the individual tables and views that have been converted from the database.


You can see the structure of the table and the logical relationship between the tables and views from the data Model diagram.




Four How to get the Model diagram of reverse engineering

In rational rose, some model diagrams are not generated automatically, and many times this work requires manual completion by the user. That is, Rational Rose is only responsible for generating models, including the elements in the model, the attributes of the elements, and the relationships among the elements, but requires the user to do some extra work to get the view.

First, through reverse engineering, the user has got the UML model or the various components of the data model and the relationship between them. The next step is to create a view on the model that can be a class diagram (class diagram, describing the static structure of the system) or a data Model diagram (the Digram, which describes the relational data structure). Then, manually drag elements from the left side of the explorer into the view, in which the associations between the elements are automatically represented in the diagram without requiring the user to do other work.

For example: the process of generating a data model diagram for a data model

From the left, drag the data element from the data model to the data Model diagram on the right, the diamond arrows for the dependencies between the table Customercustomerdemo and the table Customerdemographics are generated automatically without manual action.


In general, a system involves a lot of data elements, resulting in a crowded view, layout is very difficult. The automatic typesetting feature provided by Rational Rose is a convenient way to help users solve this problem.

By selecting Format->layout Diagram, the system rearranges all the elements in the diagram in the best way, giving the user a clear view.






Click to view larger image




Five Summarize

Understanding the reverse engineering function of rational rose, users can easily use this tool for the analysis and research of large database-related C + + systems.

Comments

①IBM Rational Software Architect is an integrated design and development tool that enables users to develop structured applications and services in a UML model-driven development approach.

②IBM Rational Software Modeler is a customizable visual modeling and design tool based on UML2.0, which follows the workflow provided by the System architect, System analyst, designer, etc. to write clearer documents and communicate and design more effectively.

Various types of model descriptions provided by ③UML

Use case Diagram Diagram: Describes a functional unit provided by the system, primarily to help the development team understand the functional requirements of the system in a visual way, including relationships based on the "role" of the basic process (actors, other entities interacting with the system), And the relationships between use cases within the system.

Sequence diagram (Sequence Diagram): A detailed process that shows a specific use case (or part of a use case).

State diagram (Statechart Diagram): Represents the different states of a class and state transition information for that class.

Activity Diagram: Represents a Process control flow between two or more class objects when an activity is being processed.

Class Diagram: Represents how different entities (people, things, and data) are related to each other, in other words, it shows the static structure of the system.

Component Diagram (Component Diagram): Provides a physical view of the system. The component (Component) represents information about the model code base, the execution library, and other components. The component is the actual module of the code, and the main user of the component diagram is the person responsible for controlling the code and compiling the deployment application. Some components are code libraries, and some are running components, such as execution files or dynamic-link library (DLL) files. )

Deployment diagram (Deployment View): Indicates how the software system is deployed to the hardware environment.

Data Model Diagram (DIAGRAM): Describes relational data structures.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.