What you want to see on DotNetFunda.com ?
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 5340 |  Welcome, Guest!   Register  Login
Home > Articles > Visual Studio 2010/12 > Visual Studio 2012 Features–Code Clone Analysis

Visual Studio 2012 Features–Code Clone Analysis

1 vote(s)
Rating: 4 out of 5
Article posted by Ambily.Raj on 9/11/2012 | Views: 2870 | Category: Visual Studio 2010/12 | Level: Beginner | Points: 250 red flag


Visual Studio 2012 introduced a very helpful feature called Code Clone Analysis, which will search the solution and find out the duplicate code snippets.


If you worked in any maintenance or support project, one of the main challenges is to find out the duplicate code, which makes the system less maintainable. Visual Studio introduced the new Code Clone Analysis feature, which will tell us whether a code snippet exists in any of the files in the solution or not.


Code Clone Analysis

For our sample, I am using the default ASP.Net web application with dummy code copied across the solution.


Select the code snippet and right click.



Select “Find Matching Clones in Solution” option from the Context Menu



You can find the Code Clone Analysis result displayed. From the result window, you can navigate directly to specified code files.



From the results window, you can compare two matching code snippets using the Comparison tool



The output of the Comparison tool



 

Solution Level Code Clone Analysis

Instead of searching for a particular code snippet, we can perform the Code Clone Analysis on solution level also.


Select the Analyze Solution for Code Clone option from the Analyze Menu.



This will search the entire solution and display all the cloned code details. In our sample, we have 4 matches found. As you can observe from the Code Clone analysis Results window, the analysis results will be displayed depends on the degree of match found and how many files are involved in a particular code clone match.


We have 4 matches with 4 Clone groups – Exact Match, Strong Match, Medium Match and Weak Match.



Expanded view of the Code Clone Analysis results



 

Conclusion

Visual Studio 2012 introduced many new features to boost the developer productivity. One of the main features is the Code Clone Analysis, which analyze the code and output the duplicate or cloned code snippets information.

 

If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

About Ambily KK

Experience:9 year(s)
Home page:http://ambilykk.com/
Member since:Tuesday, May 18, 2010
Level:Silver
Status: [Member] [Microsoft_MVP] [MVP]
Biography:I have over 9 years of experience working on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP .Net and Ajax. My interests also include Office Open XML, Azure, Visual Studio 2010. Technology adoption and learning is my key strength and technology sharing is my passion.
>> Write Response - Respond to this post and get points
Related Posts

In the real world application development we deal with windows application and after programming the app, the time comes to create the Installer or the Set up file.In this article we will explore the same.

Performance of an application is very important for a multi-user application. Performance is not only the speed of execution; it includes the load and concurrency aspects. Visual Studio is one of the tools used for Performance Test. Visual Studio Test edition or Visual Studio 2010 Ultimate provides the support for test automation.

Visual Studio 2010 supports the extensibility of the IDE. We can develop our own extensions for VSTS 2010 and also a set of very useful extensions are available online. In this article, we will discuss about one of the extensions or Power Tools available as part of Visual Studio Gallery- Feature Builder.

Visual studio supports various tests to perform the test automation and performance test. We already discussed about the Web test and Load test features. In this article we will discuss more about the Generic test feature of Visual Studio 2010.

Describing the Visual studio 2010 Architecture Features.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/26/2013 12:25:41 AM