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 have found most of the comparison tools compares just text. But sometimes it will be better to have a option for comparing files of a specific languages. The comparison can be made better if the two source files has many changes. Because it would be able to compare match named or unnamed language blocks, even it is in different part of the source files.

So, it there anything like this?

share|improve this question

closed as off-topic by MichaelT, Dan Pichelman, Bart van Ingen Schenau, mattnz, jwenting Jul 14 at 10:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – MichaelT, Dan Pichelman, Bart van Ingen Schenau, mattnz, jwenting
If this question can be reworded to fit the rules in the help center, please edit the question.

There are some tools that detect copy-paste programming, esp for C#/Java. They might help. –  Macke Jun 18 '11 at 8:16
@Macke Can you please name the tool? –  Gulshan Jun 18 '11 at 8:34
Related: stackoverflow.com/q/5779160/377657 –  rwong Jun 18 '11 at 8:52
Eclipse can do this for Java files (and probably others too). –  user1249 Jun 18 '11 at 10:25
@Gulshan: CloneDR finds duplicated code in C# and Java. See www.semanticdesigns.com/Products/Clone (my company's product) –  Ira Baxter Aug 31 '11 at 5:16
add comment

2 Answers 2

I would try Beyond Compare by Scooter Software.

While it is a text comparer, it does take language aspects into account and has options to ignore "unimportant" differences like whitespace/tabbing/comments/etc. It comes with many languages already setup, which you can change and add to so you can teach Beyond Compare a new language. Alignment is a lot better thanks to the fact that you can assign importance to certain keywords.

A big plus of Beyond Compare is that it doesn't just say "these" lines differ, but also shows you where they differ... And when Beyond Compare gets the alignment of code wrong, it has an easy "Align with" context menu option so you can steer it in the right direction.

Apart from that it has plugin facilities to add custom processing for file types it doesn't yet know, or your own for files it already knows. You can use this to turn a file into a text base that Beyond compare can work with.

In addition Beyond Compare is pretty good at comparing Excel files etc. It will pinpoint the changed cells rather than marking entire rows.

I couldn't develop without Beyond Compare! (And no, I am in no way affiliated with Scooter Software other than being a very happy client).

share|improve this answer
I don't need just ignoring unimportant portions. I need much more language specific things like block and symbol(variables or functions) awareness. Now we are merging a large volume of C source file. We are using Beyond Compare. And I can tell, I am not happy with it. Actually that's the reason I asked this question. –  Gulshan Jun 21 '11 at 9:46
Just try it, it has a free evaluation period. I can assure you it is aware of the importance of begin/end/function/procedure/etc keywords for Delphi and many other languages. And if it isn't aware of your language now, you can tell it what is important in your language. Just study the settings for any other language to see what can be done. –  Marjan Venema Jun 21 '11 at 11:28
add comment

Please see Ira Baxter's Smart Differencer.

These tools compare code using the syntax of the programming language rather than source lines. They are insensitive to language-specific whitespace and comments. Diffs are reported in terms of langauge elements (identifiers, expressions, statements, blocks, methods, ...) and plausible abstract editing actions (insert, delete, move, copy, replace, rename-identifier-in-block) which makes understanding the deltas easire (in our opinion) than line-based diffs.

Original post here. (It is a commercial tool, and an individual license for a single language will cost $200 or more.)

Rant: The price tag is perhaps an indicator that this kind of language aware tools fall into the realm of Computer-Aided Software Engineering, and is beyond the affordability of regular software developers.

share|improve this answer
Anti-rant from the tool developer: What are you paid to be a software developer, and what is your time worth? You might decide it isn't worth it, but I have trouble believing you can't afford it. –  Ira Baxter Jun 19 '11 at 21:44
@Ira Isn't there any screenshot? –  Gulshan Jun 21 '11 at 9:48
Further anti-rant: it's more than I'd pay for a tool like that for a hobby, but if you cost the company $100K/year, it has to save 0.2% of your time (i.e., about a minute a week) to break even in a year. –  David Thornley Feb 3 '12 at 17:25
add comment

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