Interview with Clone Detective's Immo Landwerth
We interviewed Immo Landwerth of the open source project Clone Detective for Visual Studio. This project leverages ConQAT to analyze C# code for duplication.
What originally prompted you to create Clone Detective?
Clone detection is a very versatile but still underused quality tool. Code duplication can have many different reasons ranging from lazy copy & paste developers over limitations in the programming language to architectural constraints. Today clone detection is not wide spread because the tool support is not there. The goal of our project is to bring clone detection directly to the developers - that is why we created a Visual Studio integration instead of a standalone tool.
Clone Detective provides three important features for developers. The first two are very obvious: it allows you to run a detection and browse the resulting clone report. The third is not so obvious. If you start using Clone Detective today your project might have several clones. Removing duplication creates costs and risks so you will not be able to remove them all right now. You will find a way to deal with them. Here comes the second feature into play. Clone Detective marks all source code that is duplicated with a purple bar in the margin. This might not sound impressive but consider the most common maintenance use case. Some dev is fixing a bug in your project. While coding he notices the purple bar and remembers that this indicates a clone. Now the dev will quickly look at the other occurrences of this clone and check whether he must apply the bug fix to them too. This is a very simple way to deal with clones: keep them but ensure the source code remains consistent.
The next version of clone detective will even be able to find "fuzzy clones". These are clones are almost identical but with differences. These clones are particularly interesting because they might indicate inconsistencies in your code base.
You mentioned keeping duplicate code, but using Clone Detective to alert maintainers that the clones need to be checked. Was this technique one of your original goals or was it something you discovered after the fact?
Well, the software competence center at the Technical University of Munich had already a lot of experience using clone detection. That means for Clone Detective the problem of keeping and maintaining clones was already well-known so it was an up-front requirement.
What is the relationship between Clone Detective and ConQAT?
ConQAT is a continuous quality assessment toolkit that - among other great features such as architecture analysis – is able to perform a clone detection. ConQAT has been designed as a tool that is integrated in your build process to produce high level information that can be used to create a project cockpit web site.
Clone Detective is a Visual Studio hosted graphical user interface for ConQAT's clone detection. ConQAT does all the hard work required for clone detection such as reading and analyzing the source files. Clone Detective provides the visualization and integration work so that people can quickly create and browse clone reports.
Do you currently plan on exposing any other ConQAT features to Visual Studio?
No. However, we will expose all features of ConQAT that relate to clone detection, i.e. file filters, black lists, and fuzzy clones.
Tom Gilb & Kai Gilb Jan 26, 2015