RAD Studio (Common)
ContentsIndex
PreviousUpNext
Code Visualization Overview

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.

RAD Studio has a code visualization diagram that 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. This topic covers only the code visualization diagram.

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 and UML Packages

To begin, code visualization consists of two parts of the IDE working together: The Model View window, and the Diagram View. 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 Delphi unit declaration in your source code. 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 Diagram View, 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.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!