RAD Studio for Microsoft .NET |  |

Code Visualization Overview
Code Visualization and UML Static Structure Diagrams | Understanding the Relationship between Source Code and Code Visualization | See Also
Collapse All

The Code Visualization feature is available in both the Enterprise and Architect versions of RAD Studio. All other modeling tools and information related to modeling relates only to the Architect version of RAD Studio.

Code Visualization and UML Static Structure Diagrams

RAD Studio's code visualization diagram presents a graphical view of your source code, which is reflected directly from the code itself. When you make changes in source code, the graphical depiction on the diagram is updated automatically. The code visualization diagram corresponds to a UML static structure diagram. A structural view of your project focuses on UML packages, data types such as classes and interfaces, and their attributes, properties, and operations. A static structure diagram also shows the relationships that exist between these entities.

This section will explain the relationship between source code and the code visualization diagram.

Note: code visualization, and the integrated UML modeling tools are two separate and distinct features of RAD Studio. Code visualization refers to the ability to scan an arbitrary set of source code, and map the declarations within that code onto UML notation. The resulting diagram is "live", in the sense that it always reflects the current state of the source code, but you cannot make changes directly to the code visualization diagram itself. RAD Studio's model driven UML tools go a step further, giving you the ability to design your application on the diagramming surface. While both product features are based on CodeGear Together technologies, they each use different underlying mechanisms to produce and manipulate the diagram. The integrated model design surface is additionally based on the designtime capabilities of CodeGear's Enterprise Core Objects (ECO) framework. This document covers only the code visualization. For more information about building applications with the ECO framework and using the wizards and modeling tools with ECO-enabled applications, see the separate ECO online help.
Understanding the Relationship between Source Code and Code Visualization

RAD Studio's code visualization tools use the UML notation and conventions to graphically depict the elements declared in source code. The Code Visualization diagram shows you the logical relationships, or static structure in UML terms, of the classes, interfaces and other types defined in your project. The IDE creates the Code Visualization diagram by mapping certain source code constructs (such as class declarations, and implementation of interfaces) onto their UML counterparts, which are then displayed on the diagram.

Top-Level Organization: Projects, UML Packages, and .NET Namespaces

To begin, code visualization consists of two parts of the IDE working together: The Model View window, and the Code Visualization diagram. The Model View window shows you the logical structure of your projects in a tree, as opposed to the file-centric view of the Project Manager window. Each project in a project group is a top-level node in the Model View tree.

Nested within each project tree-node, you will find UML packages. Each UML package corresponds to a .NET namespace declaration in your source code (.NET namespaces can span multiple source files). You can expand the UML package to reveal the types declared within.

Inheritance and Interface Implementation

The UML term for the relationship formed when one class inherits from a superclass is generalization. When the IDE sees an inheritance relationship in your source code, it creates a generalization link within the child class node in the Model View tree. On the Code Visualization diagram, the generalization link will be shown the using standard UML notation of a solid line with a hollow arrowhead pointing at the superclass.

The UML term for interface implementation is realization. Similar to the case of inheritance, the IDE creates a realization link when it sees a class declaration that implements an interface. The realization link appears within the implementor class in the Model View tree, and on the diagram as a dotted line with a hollow arrowhead pointing at the interface. There will be one such realization link for every interface implemented by the class.

Associations

In the UML, an association is a navigational link produced when one class holds a reference to another class (for example, as an attribute or property). Code visualization creates association links when one class contains an attribute or property that is a non-primitive data type. On the diagram the association link exists between the class containing the non-primitive member, and the data type of that member.

Class Members: Attributes, Operations, Properties, and Nested Types

Code visualization can also map class and interface member declarations to their UML equivalents. Within the elements on the Code Visualization diagram, members are grouped into four distinct categories:

- Fields: Contains field declarations. The type, and optional default value assignment are shown on the diagram.
- Methods: Contains method declarations. Visibility, scope, and return value are shown.
- Properties: Contains Delphi property declarations. The type of the property is shown.
- Classes: Contains nested class type declarations.

Standard UML syntax is used to display the UML declaration of attributes, operations, and properties. Each of the four categories can be independently expanded or collapsed to show or hide the members within.
See Also

UML Features in Delphi for .NET (Architect SKU only)

Integrated Modeling Tools Overview (Architect SKU only)

Importing and Exporting a Model Using XMI (Architect SKU only)

Using the Model View Window and Code Visualization Diagram

Using the Overview Window

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!