There are few tools reasonable developer can’t really work without. Well, actually maybe he can, but lack of those seriously impacts quality and pace of his work. Dedicated IDE is one of those, but there are some minor ones as well: source version control tool, unit test runner, debugger, profiler and at last but not least - file comparison tool: preferably one capable of 3-way comparison: critical to proper handling of file merging and conflict resolution.

Some go for the easiest (and cheapest) options: WinDiff, WinMerge (http://winmerge.org/) or kdiff3, but I was never stingy on tools I find critical for my work, that’s why I’m using Beyond Compare 3 (http://www.scootersoftware.com/) for quite a long time now. It’s quite cheap, very easy to set-up and does it’s work very well. But it has it’s limitations - if I’m merging severely refactored code files, BC3 easily gets lost when the order of methods or their formatting changes. That’s just because BC3 has no clue about programming languages and logical abstracts used within code files - it just compares bare text without trying to interpret and understand their content.

Some time ago Semantic Merge (http://www.semanticmerge.com/) was announced - the new tool that was (is) supposed to fill the gaps in traditional merge tools due to its ability to understand and analyze the code syntax. Few days ago it has reached 1.0 milestone and that sounded like a great moment to try it out, especially keeping in mind that you can start with short, 1-month long licensing period (very cheap, as it should be).

How does it work then? Does it really do what it promises? In general = yes, but it has some infancy period problems…

Pros:

  1. I did some manual tests on cases I’ve prepared (I’ve checked some samples delivered with the installation package as well) and semantic merging for C# indeed works quite well -> SM is able to recognize moved parts of code, even if you’ve refactored their names as well. I’ve seen re-arranging option as well, but I haven’t tried it yet.
  2. It’s capable of building the hierarchical code map for the merging result - that’s very convenient as you can easily navigate within merged code. Forget about typical kdiff3 problems, when you’ve got conflicts that spanned through several methods, shredding and slicing them into pieces.
  3. It’s very clean and concise - each quantum of information is presented in an obvious way, you’re not overflowed with information either. The looks are gorgeous.
  4. Option named “visual diff” is capable of rendering a graphical UML-like (class diagram) map of the code merged within particular file. It aids the merge decisions with visualizing the flow of code parts within and between classes (in a very neat way).

Cons:

  1. The first one is quite huge: you’re buying a license for one particular language / technology and SM will show its goodies only as long as you stick to that. What does it mean? As I have a .NET version - if I merge CS files, it’s all cool, but if I have to do the same for *.csproj, *.config, *.xml - no way, I can do that using the usual bare text merging option (and it looks far more limited than BC3). If I occasionally do Java development - no luck either (I’d have to buy another license). If I want to merge JavaScript files - no chance, SM doesn’t have a version for JavaScript ;/
  2. SM integration with tools doesn’t work out of the box - period. I used the descriptions on SM’s official site, they were corrected in the meantime but they still don’t work. Running diff for Mercurial command-line gets completely lost when I compare whole commits (that contain more than 1 file), running diff in Source Tree (https://www.atlassian.com/software/sourcetree/overview) doesn’t work at all ("The contributors must be specified", what?!). I still can use the tool manually, but it’s far less convenient.

Am I going to use Semantic Merge then? Will I extend the license? I haven’t decided yet, but keeping in mind that I don’t restrict myself to C# only, but I also do Scala, JavaScript, Ruby, PowerShell, Clojure - SM limitations seem very annoying. Is the actual feature of semantic merging worth paying extra for it just for C# development? I’m not so sure, but I have to give it a go for a bit longer.

I’ll keep you updated.

Share this post