Thursday, 8 March 2012

Code Clone Analysis: a quality enhancer in day by day use

A huge problem we have in team development is code recycling.

Sometimes it may be good, recycling some factory-like code we previously created to be reusable, but most of the times it’s a mere copy-paste which leads to problems.

In Visual Studio 11 we have a great aid in avoiding this: Code Clone Analysis.

By selecting a code snippet, we can right-click it and selecting “Find Matching Clones in Solution”

image

It searches in the current document for clones, with various level of matching

image

This could be extended to the whole solution, by selecting “Analyse Solution for Code Clones” under the Analyze menu.

image

No comments:

Post a Comment