Thursday, March 20, 2008

Favorite Tools: Beyond Compare

Diff tools are awesome. If you are not using a diff tool you should really consider giving it a try. My favorite diff tool is Beyond Compare.
I like BC because it does more than just compare two text files. BC will also compare archive files intelligently: zips, jars, wars, ears, etc.
It is what I would describe as one of the most mature software products out there. There is a lot of polish on it and it seems to be able to be integrated with just about anything. BC has one of the most generous shareware licenses out there, it's a 30 days of use license. You get to use it on 30 separate days before, well I don't know what happens because I bought my license, $30, after about 5 days of use.
One of the things I really like about BC is it has a very clean interface for showing the differences in files. It has nice color coding and doesn't do anything fancy with alignment.
BC has saved me a lot of stress by comparing one version to another.
We had a project that was at risk of missing its deadline. A few hours before we were set to deploy we found a set of regressions. All I knew at the time was that the regressions were not in the build three days prior. I was able to load a version tree from three days prior and the current version and perform a diff of the entire source. Within minutes I could review all of the files that were changed and the lines where they were changed. We were able to find the source of the regressions very quickly.
I use BC with my source control tools. It integrates easily with Tortoise CVS--not my choice to use CVS--and it works well. One thing I like to do before I check anything into source is review it. With Tortoise and BC this is easy. I can right click commit on the source folder and Tortoise will list the modified files. I can right click on each of them to see the differences in BC. BC will let me edit the diff directly, so for example if my indenting is off I can take care of that in the diff, or if I commented out some code I can remove that commented out code. The net result of diffing your submissions is you are more aware of your submissions and there are less unintended code commits.
A surprising benefit of BC is it can be used to edit very similar files. I did a recent project in Spring Web Flow, and found BC to be a great tool. Web flow is a framework that, among other things, features flows, xml documents that describe the different paths that a UI can follow and the logic that gets performed along each step. In my application I had 5 different flows that were structured the same way, but with different business logic.
Beyond Compare helped me with the process. Normally, when I'm working on multiple files that are pretty similar with minor differences I would need to be very careful about making changes, because it's very easy to lose track of them. With BC, I didn't need to worry about those things, I could experiment away with one flow document and then quickly propagate the net changes to the other similar documents through a diff. Any minor changes that occurred could be hand tweaked with inline editing.
BC is awesome. There is no reason why anyone shouldn't at least give it a try.

No comments: