[# VS11] Detecting duplicate code sections

image

Hi,

Today we will see an interesting option for the analysis of code which has been incorporated into Visual Studio 11. In this case it’s the ability to find code sections duplicate within a solution.

We all know that in the rush of every day, many times we skip all the good practices and instead of giving her a bit of the thinking machine, use the copy & paste as patron of implementation of code. In the long run we will bring more problems than solutions, but… well not I want to tell something they already know.

If you are working and you find yourself with a piece of code that “gives you a bad smell”, now have the ability to select it, display the contextual menu and select the option “”Find Matching Clones in Solution“.”

image

As I wanted to do a test on a good code base and good, so I decided to analyze the source code of Enterprise Library 5.And after a while of searching I found duplicate portions of code, add a new class in which “I commissioned to force the error”.

When you end the search for duplicate sections, you will see that, in the results window, we can see the selected code and its clones.

image

If on the other hand select a portion of code that is repeated more than once, because we can see the different results in the results window. These results may be “exact copy”, or even partial implementations of the code that analyzes, cool Risa

image

Greetings @ Home

The Bruno

   

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s