Is there a tool that can do a diff of two methods? I'm working on some legacy code that has several 100-200 line methods that contain a lot of duplication and I would like to abstract the duplication out. Being able to diff the two methods would be a huge help. In case it matters, I'm working with .NET and Visual Studio 2008.
I'd recommend Simian: http://www.redhillconsulting.com.au/products/simian/
Visual Studio 2008 Team Edition has documaent comparison rolled into it. So depending on what version you are running you may just need to right click on the solution explorer and chose 'Compare'.
The subversion GUI client Tortoise can make a diff of two text files (or code files in this case), just copy both methods in a different txt file, select them, right click and from the tortoise menu choose diff.
Sourcegear's Diffmerge is very nice and free. You would need to cut your code into different files so they could be compared side/side. You can use this (and most similar utilities) to compare three files at once.
Don't know if this is practical for you, but (unsurprisingly) emacs can do this for regions within two files both as a line-by-line or word-by-word comparison.
look up emacs ediff if interested (it also does file/buffer compares, file against ancestors, patches, 3 file compares and merges.... pretty comprehensive). I don't think I've seen a diff/merge system in any other programming editor quite as good.
You could use a tool like Diffuse. Just drag and drop your files onto either pane, pick a line from one method, right click on what should be the corresponding line in the other pane and choose "Align to Selection". You can even double click then start re-factoring the code directly in Diffuse.
Compare++ just meets your needs. The diff tool is a visual specialized tool for source code file comparison, merging and folder synchronization. In the website:http:www.coodesoft.com,there are many screenshots, you can review them.
What you can do with Compare++
- Compare sub-sections of files such as code structures;
- Compare files and folders with lightning speed;
- List all code structures change such as function changes
- One step to merge multiple differences from side to side
- Compare the containing folder for loaded files
- Support "Edit files and instantly compare"
- Automatically detect files and folders changes outside