Friday 28 November 2008

Clone Detective

Ever had that deja vu feeling when coding in a project? Ever thought, hang on, I've seen something similar to this code block before? Are you keen to factor out duplicate code from your systems? Of course you are, so take a peek at this:

http://www.codeplex.com/CloneDetectiveVS

Clone Detective is a free add-in (built on ConQAT) for Visual Studio that analyses your C# projects for 'duplicate source', that is, similar code once any 'noise' has been removed (normalisation) and tokenised. Whether this is from sloppy copy & paste activities in your team or simply properties in N-Tier DTOs, BDOs etc, as professional software engineers (eh?!) we want to know about such things. It's then up to you to decide if the clones are ok or if further action is required, considering any refactoring costs involved.

Watch the 10min video as a starting point to see if this tickles you in the right places. It did me :-)

I ran it past one of my projects:

The figures in brackets are the percentages of code cloned. The coloured bars indicate where in the file the potentially pikey coding is. Some of the source identified in this case was simply properties in my BDOs but there were other cases where it did point out areas of my code where some refactoring could take place. Nice (the add-in that is, not my coding).

_mrC