CaseMatters.com
Solutions for IP Attorneys & Expert Witnesses

Source Code Compare Explained    Samples

Soure Code Compare Explained

The source code comparison process is an iterative one. The Soure Code Compare accepts two source code files as input to compare. As previously mentioned the file on the right (file B) is always the focus. In other words, the file on the left (file A) is compared to the file on the right (file B).

The Soure Code Compare will automatically identify three types of lines:

  • Literally Identical/Translated lines
  • Blank lines
  • Unique lines

When the Soure Code Compare is run for the first time for a given pair of input files. It will attempt to line up lines that are literally identical/translated in the A file with those of the B file. Also, statistics are generated that indicate the number of total lines for file B and the literally identical/translated lines, functionally identical lines and filtered lines for the compared file A as well as the percentage of total number of lines for each.

This output is then reviewed in an attempt to find other similarities such as, functionally identical lines and known translations. Known translations are terms used in the source code from one side that logically mean the same thing as a different term on the other side. For example, 'from' and 'source' or 'to' and 'dest' or 'car' and 'automobile'. By identifying known translations and re-running the source code comparison program with these known translations, the result can lead to more literally identical/translated lines. The iterative running process allows the user to reveal more similarities (by defining more known translations) between the two files being compared on each successive run.

As mentioned before, the Soure Code Compare will attempt to line up those lines that are literally identical/translated in file A with those of file B. However, manual alignment can be performed after the source code comparison output file is generated. In addition, other manual changes made be made by identifying functionally identical lines and filtered lines.

CaseMatters.com provides consulting services to assist in identifying known translations, functionally identical and filtered lines in the file comparison process.

For example, let's compare two files: CPlusCopy.cpp to objectUtils.cpp. The full compare example can be viewed in our source code comparison sample page. For our use here we will use a snippet of code as illustrated below. Please note that all literally identical/translated lines are shown in underlined red font.

First Run

The snippet shows the automatic alignment of a few lines that are literally identical/translated:


Subsequent Run

As you can see in the snippet example above, there are some know translations we could use: ‘to’ in file A is equivalent to ‘dest’ in file B and ‘from’ in file A is equivalent to ‘source’ in file B. We'll use those on a subsequent run and we'll get two more matching lines:

Manual Markup

Let us now indicate which lines are functionally identical in this example. Line 20 in file A is functionally equivilent to lines 46 and 47 in file B as is line 22 to 49 and 50 respectively. These markups would have to be done manually.


Statistics

The statistics show up on the side of file B and indicate the number of Total Lines for file B and the literally identical/translated lines, functionally identical lines and filtered lines for the compared file A as well as the percentage of total number of lines for each. Also note the list of translation equivilents used in the compare.


Copyright 1999-, CaseMatters.com. All rights reserved. US Patents 8,433,708; 8,744,135; and patent pending.