There's a tool called PMD that lets you do all sorts of nifty things to java code, looking for possible bugs, dead code, suboptimal code and overcomplicated expressions. Unfortunately (or fortunately), I don't code in Java, but there is an additional tool in the set, CPD which let's you find duplicate code sections.
Duplicate code sections are bad, because if you copy and paste something, and there's a bug, then you've copied the bug which might get missed in a bugfix. But all seasoned coders know such things. I always remember the phrase "Code duplication is an error.", and sometimes I even pay attention to it ;-).
The good thing about CPD is it works with C, C++, Java, JSP and PHP, so it should be a worthy tool to add to a programmers collection.

Post new comment