Black Friday is here! Get up to 30% off on Devart products!
ends in   {{days}}
Days
{{timeFormat.hours}}
:
{{timeFormat.minutes}}
:
{{timeFormat.seconds}}

Similar Lines Detection

Overview

Similar Lines Detection is yet another advanced option available in Code Compare Pro.

Most available comparison algorithms search for strictly equal strings. Even if a file contains only minor changes, the respective blocks will be treated as different ones. Because of that, comparators can sometimes return incorrect results.

Code Compare Pro tool is fitted with a special solution for this problem. The Similar Lines Detection feature detects approximately equal strings providing better comparison results.

This feature can function in either of two modes: a Common Mode and a Quick Mode. The default setting is Quick Mode and most often it is your best choice. When in Quick Mode the comparison tool disregards spaces and takes into account string length only. If you disable the Quick Mode, the contents of the strings will be compared.

Triggering

Similar Lines Detection is enabled by default and can be turned off using the Comparison Options menu. Click the Comparison Options button and uncheck the Similar Lines Detection checkbox. Code Compare Pro will then start using the usual comparison algorithm. You can also trigger the Quick Mode for Similar Lines Detection using the respective checkbox.

Comparison options

Usual Comparison vs. Similar Lines Detection

The example below shows a typical case. The code was updated with two minor additions, namely:

  • a simple check;

  • one more parameter in the method call.

The usual comparison algorithm returns the following result:

Usual comparison - minor difference

The blocks are treated as different, despite their obvious similarity. Enabling Similar Lines Detection allows drastically enhancing the comparison result. Code Compare Pro treats the blocks as similar and highlights the minor difference. For this example we used the Quick Mode of Similar Lines Detection.

Similar Lines Detection - minor difference

Quick Mode vs. Common Mode

Sometimes, however, the Quick Mode can be insuffiecient for your purpose, which is illustrated by the following example.

A new position has been added to the database and parameter has been renamed.

Similar Lines Detection - Quick Mode

Relying on string length only, Similar Lines Detection feature associated the blocks incorrectly.

Similar Lines Detection - Common Mode

With the Quick Mode disabled, Code Compare Pro compares the contents of the blocks and associates them correctly, highlighting the difference.

For details on the major feature set of our file diff and merge tool, refer to the overview page of Code Compare.