Code Comparison - Between Two Analysis of Same Code

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 Analyses of your Code

  1. Click on the ‘Comparison’ tab on the ribbon menu as shown below:
    Visual Expert Code Comparison Menu
  2. The left section of the ‘Comparison’ tab allows you to compare 2 analyses of your code.
    Compare 2 Visual Expert code analyses
  3. In order to use this feature, your Visual Expert project must be analysed at least 2 times. These dropdowns contain the list of historical analyses.
    Code Comparison Tutorial for Visual Expert
  4. Select the analyses you need to compare. 
    Selection of analyses to be compared
  5. Select the required object in the Main View, and click on the ‘Compare 2 Analyses’ button 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 limited to an object type with Visual Expert

You can also select the "Compare 2 Analyses" macro in the Navigation bar.

Launch the Visual Expert code comparison from the 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 analyses.
  • 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).

  • Visual Expert code comparison options

  • 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 comparison result is displayed in the Main View using different colour highlights:

  Deleted components

  Updated components 

  Added components


Comparison result of two Visual Expert code analysis

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