The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Code Formatter

Posted by Matt Gerrans on November 23, 2001 at 2:32 AM

Hi Jody,

Yes, merging can be a problem if the curlies are always moving. I think there are some tools that can display it the way each individual likes it, but save it in one consistent way. I've heard some rave reviews about an editor called Intelli-J as far as doing lots clever things; I wonder if it does this...

The other solution is to have an automatic reformatting of your code to the group standard before it is checked in (that is chain it into the check-out and check-in automatically, so it comes in the format you like and goes back in the format that the group has agreed to).

As a matter of fact, now that I've mentioned it, I'll think I'll try setting this up with my current project using CVS. I need to hunt down a good formatter now -- JPretty is the only one I know of for Java, but I'm sure there are others.

- mfg

> Matt,

> Interesting that you brought up code formatters. I sometimes find that a tool that is supposed to "aid" development can cause more problems. I use Visual Age at work for my development, for my sins. Not only does it have a code formatter, it is customisable. If you want curly brackets on the same line, you can configure it. If you want them on to appear on their own lines, you can configure it. All it takes is a CTRL-W and all your code is nicely formatted just the way that you like it. This is fine, until you are working in a team development. Try doing a code merge where different developers have been making changes to the same section of code but use different settings. Personal choice is great, though sometimes at a cost.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us