15 December 2004

Semantic diffs with XML

Martin Fowler had an interesting thought (his website is actually full of them; I'd encourage browsing) recently about the next step in the evolution of version control tools: what he calls semantic diffs.

From my perspective, building this type of functionality into useful tools seems much more possible now that Microsoft and other companies are moving their proprietary formats towards text-based XML formats. To take Microsoft as the biggest example: not only are they using XML for Word documents and Visio diagrams, they're also building their new Avalon user interface layer with an XML schema called XAML.

As you know, comparing text file is a cinch, and when the differences come back as XML or an XML fragment, it would be relatively trivial to develop an application-specific display for such diffs.

It's exciting to think of Visio displaying the changes you've made to a diagram, or Word comparing two different versions of a document and showing you the changes as a Word document. Definitely useful.

Of course, that doesn't take things to the full extent of his idea: tools understanding the overall reason for the change. For instance, Visio could tell you that the three edits between this version and the previous version of the diagram relate to the insertion of a new class in your diagram. That is the sort of extrapolation that's interesting to ponder, but not likely to eventuate any time soon.

In the meantime, we'll just have to rely on our developer's comments and the frequency of commits to provide us with semantics for the changes.