Cool Code
Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Jonathan Allen on Oct 08, 2008
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.
Using Drools? See what you're missing! Get the Power of Drools with the Assurance of Red Hat
Five Key Practices to Agile ALM
Federated Identity Management and Single Sign On
Fair Trade Software Licensing - A Guide to Neo4j Licensing Options
Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.
Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.
Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).
Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.
Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.
One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.
InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.
Alex Papadimoulis discusses ugly code, where it comes from, how to avoid it, and how to get rid of it.
No comments
Watch Thread Reply