Note: All screen shots are thumbnails. Click to see them bigger.
Have you ever stared at two pieces of similar code, one that worked and one that didn't, and tried to sort out "what the heck is different"? Or perhaps you are considering merging two functions into one. This is a differencing problem, but not of two versions of the same file. Fortunately, Understand 2.0 provides two ways to help with this:
- Arbitrary Text Differencing - this provides two text buffers. Paste into each, do a diff.
- Entity Comparison - select two separate entities and compare them.
I'll show examples of each.
Abritrary Text Differencing
Access this function via the Change->Compare Abritary Text menu.
Select text, and paste it into the left or right. Then select other text and paste it into the other side. ![]()
Hit Okay and the difference pops up:
I can see that the "-help" argv processing part is missing and that a nasty cut and paste error missed a meaningful command line argument. Our engineers tell me they use this feature every day. Before they used to have to paste into files and then diff them.
Entity Differencing
Entity differencing is useful when the entities are similar, perhaps from inadvertant duplication of functionality during a merge of formerly separate sources.
It works very similar to Arbritrary Text Differencing. Just choose "Change->Compare Entities" and an entity picking window pops up. Filter on names. Type in the list of entities. As you pick entities on left and right they are automatically compare.
Here I look at two functions Udb:sDbCheckMaintain and Udb:DbCheckMaintain. Once operates on snapshots the other on the current database. I expect them to be similar, and they are:
I did this just for an example. These routines while similarly named do quite different things. One is part of the checking when opening a new project, the other for checking the validity of snapshots - and assumes an open master database.
We plan to add more semantic information to Entity Differencing. For instance, identifying different dependencies, globals read, globals set, and differences in the call trees that setup their operation. Each these can provide that "ah ha" trigger than makes clear the source of a problem.

Leave a comment