aspose file tools*
The moose likes Java in General and the fly likes Need right tool for java coding standards & code review Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need right tool for java coding standards & code review" Watch "Need right tool for java coding standards & code review" New topic
Author

Need right tool for java coding standards & code review

Kather Basha
Greenhorn

Joined: Apr 12, 2004
Posts: 20
Hi all,

for my current j2ee project we are in the process of selecting right tool to define coding standards and to review existing java code.

Kindly help any one to get into right path regarding this.

thanx

Kather Basha.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Besides a good code formatter (there are several out there, and most IDEs come with one), you don't really need a tool, in my not so humble opinion. What you need is a very basic, informal coding standard that is *in the heads* of your team, and which gets refined while your team closely collaborates on the project (assuming that they are colocated). Pair Programming, for example, is a very good "tool" for propagating a team wide coding standard.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
There's no substitute for a battle-tested and informed software engineer with an interest in keeping up-to-date on best practices but there are plenty of books out there that will help. First carve your requirements in to coding standards (easily automated with tools like Jalopy from Triemax) and code structure (you will need skilled developers and highly regarded books on the subject) and finally development process: Evo or UP or XP.

Those are three separate areas where the code beautifier (formatter) is the least important because it can be automated.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Some of the static code review tools do a pretty cool job of spotting potential bugs, but most of them primarily critique your indenting and commenting. A good code formatter will take care of indenting, and the "standard" level of commenting they suggest is redundant at best and counter-productive or dangerous at worst. Go with human reviews.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
    
    1
Take a look at CheckStyle


Sun Certified Programmer for the Java 2 Platform
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I agree partially with Ilja, you need to 'live' these values and try not to patch it after the fact.

However in our case we use Eclipse wilth a standard set of formatting rules used by everyone (and enforced) and JCSC to check code quality, although code reviews does most of this for us.
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
If you are into static analysis tools, FindBugs and PMD are fairly good.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41816
    
  62
With PMD it's easy to add your own rules, something you will want to do sooner or later.
When selecting a tool I find it important that it integrates seemlessly into the build environment, whether that is Ant, Eclipse, NetBeans or IntelliJ. Otherwise it just won't get used as much as it should be.
Other options you might look into are JCSC, Hammurapi, lint4j and jlint. My favorites are PMD and Hammurapi (which produces very nice reports that are cross-referenced with the source code).


Ping & DNS - my free Android networking tools app
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have to admit my comments on tools were based on research a couple years old. A third party is applying Hammurapi to some of our code. I'll keep an open mind until I see what they come back with.
 
Don't get me started about those stupid light bulbs.
 
subject: Need right tool for java coding standards & code review