Code Comparison - Between Two Different Code Sets

When your application is evolving, you may need to understand what has changed between 2 specific versions. 

Visual Expert offers TWO ways to compare your code:

  1. You can compare 2 analyses of the same code: Anytime Visual Expert analyzes your code again, the previous analysis is stored for later use.
    You can pick 2 analyses from your project history, and compare them to find the differences between them.

  2. You can compare 2 separate sets of code (2 versions of your application for example) or 2 databases (development and production DB for instance) : Visual Expert will show the differences between each set of code.

How to Compare 2 Sets of Code

Requirements: to use this feature, your Visual Expert project must contain multiple applications (sources of code).

compare sources of code in a Visual Expert project

Please refer to the following tutorials for creating a project including:

  1. Click on the "Comparison" tab on the ribbon menu as shown below:
    Visual Expert comparison tab
  2. The right section of the Comparison tab allows you to compare 2 sets of your code.
    Visual Expert Code Set Comparison Menu
  3. Use the dropdown lists to select the sets of code you need to compare.
    Selection of code sets to compare with Visual Expert
  4. Select the required object in the Main Menu and click on ‘Compare 2 sets of code’ in the ribbon menu.

You can choose any scope for your comparison

  • You can compare only the objects of a given type.
    In this case, select this type of object at the root of the treeview and VE will only compare the corresponding objects (PowerBuilder Windows in the example below, or stored procedures, tables, etc.). 
  • You can restrict the comparison to a specific object: select this object in the treeview and run the comparison
  • You can compare all the objects of a given application: select this application in the section “application” of the treeview and run the comparison.
  • You can compare all the objects of a given schema: select this schema in the treeview and run the comparison.
  • Etc.

Code comparison of an object type with Visual Expert

Alternatively, you can click on the "Compare 2 Sets of Code" macro in the Navigation bar.

Code comparison from the Visual Expert navigation bar

Important: this option will not appear in the treeview until you properly configure the comparison (Please refer to point 1 to 3 above for more details).

While the Ribbon menu gives a quick access to comparison features, the navigation bar offers more comparison options:
Click the small wrench on the left to open the macro configurations. A popup will allow you to configure the result as per your need.

  • Display a complete hierarchy 
    Allows you to see the result in a complete hierarchy including child objects and components.
  • Display comments
    Allows you to include comments in the result. This will help you to identify if the comments are added or modified between the two sets of code.
  • Show undefined elements
    Allows you to include undefined elements in the result (these items are referenced in your code, but Visual Expert could not identify their nature, nor find their definition).

Options for comparing two sets of code

  • Click on "Execute" to instantly apply the changes and display the result without saving them. 
  • Click on "Save" to save the selection for future executions. 

The result is displayed in the Main View using different colour highlights for the analysed components:

 Deleted components

 Updated components 

 Added components

code comparison tutorial for visual expert

Advanced Comparions

You can configure multiple "pairs" of sets of code to be compared:

  1. Click Advanced Settings
    Configure multiple sets of code to compare
  2. Select the code sets to be compared using the dropdowns
  3. Click on "+" to add them to the list.
    code comparison tutorial for visual expert
  4. You can delete a "couple" by clicking on the red cross.
    Delete a pair of code sets to be compared

Video Tutorial

Watch this video tutorial to learn more about code comparison features in Visual Expert.

Also Compare References

Besides finding the changes made in the code of an object, you can also compare the references to this object. Visual Expert will show which references were added or removed to this object, between 2 code analyses.

To do this:

  • In the ribbon menu, go to "Comparison".
  • Select a previous code analysis to compare with the current one
  • Select an object in the treeview
  • In the navigation bar, click on "Compare references"

compare object references with Visual Expert

See Also