Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was under a tight deadline to finish a project in C#, and as a result I feel I didn't code things in the most efficient way. Now that I have time to go back and optimize the code, I was wondering if there was a Visual Studio extension or other program/service to highlight blocks of code similar to each other. This way I can break them off into functions as I need to.

share|improve this question
    
try power tools, productivity and just code –  Yusubov Jul 15 '12 at 15:20
3  
Visual Studio 2012 has that: msdn.microsoft.com/en-us/library/tfs/hh205279(v=vs.110).aspx –  Patrick Jul 15 '12 at 19:18
    
would be fair to see why answer is down-voted ? –  Yusubov Jul 27 '12 at 15:46
add comment

1 Answer

up vote 4 down vote accepted

Atomiq is a nice little app that does a pretty good job at finding duplicate blocks of code. It was written for .NET (I think it was written in WPF) and analyzes your source code files. It is not free, it costs about $30 US.

I have used it in the past and one of the things I like about it is you can set the sensitivity of the duplication by specifying lines of code of code to look for. If you only want to find really bad duplication you could set to to 10 lines of code and it will find everywhere a specific 10 lines are duplicated. You can go all the way down to one or two lines of code, but that is going to find a lot of false positives.

Not all is rainbows and sunshine with the program, it tends to report duplicates twice, once for each file it finds. Well at least in the version I used. So if Foo has a block of code that is also in Bar then you will see that block of code counted twice. And it tends to have performance issues with really large (100,000+ lines of code) projects. They may have fixed that with a newer version, I haven't had a chance to check.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.