dev@glassfish.java.net

Re: Oracle coding conventions in Mojarra and/or GlassFish

From: Bill Shannon <bill.shannon_at_oracle.com>
Date: Wed, 08 Sep 2010 21:58:29 -0700

Ed Burns wrote on 9/8/10 7:47 PM:
> I don't know if anyone else has seen this, but in Mojarra we've had
> several occasions recently to accept high quality code from elsewhere in
> Oracle, and invariable this code comes to us in a coding style other
> than that we've been using since the beginning of Mojarra in 2001.
>
> I've been reformatting the stuff to match our existing code, but, I have
> to ask, isn't it better to take some time to reformat the whole thing to
> match Oracle's coding standards?
>
> What's the official word on this sort of thing?

My rule #0 for code formatting is "when in Rome ...", that is, follow the
conventions of the code you're integrating with. It's up to the leaders
of a module/project/whatever to decide how strongly to enforce coding
conventions. You might decide that you won't accept contributions that
don't meet your coding conventions. Or you might accept them but spend the
effort yourself to reformat them. Or you might not care at all and accept
whatever you can get.

If by the "Oracle coding standards" you mean the old Sun Java coding standards
that we're all supposed to be following anyway, I suspect it's not worth the
effort to reformat your entire code base, but really that's up to you. If
you've got a relatively consistent style of your own, it's probably easier
to just stick with it. Depending on how ugly it is, of course. :-)