Hi there, initiated by a change in a pull request[1] the issue of coding style (or coding standard) popped up, once again. Instead of inventing our own coding style I proposed on IRC that we used either SUN’s Code Conventions[2] or Google’s Java Style[3].
Now that I’ve looked for the URL I would like to retract my suggestion of SUN’s
Code Conventions, those haven’t been updated since 1999… :)
So, Google’s Java Style. It’s reasonable close to what we already employ, and
formatters in the popular IDEs will probably have no bigger problem creating
output that conforms to this style guide.
However, adopting a new style guide creates an immediate problem: the existing
code. Which probably has more different styles combined than the style guide
has words. :)
I’m not a big fan of these single large commits that reformat all source code
at once. As Google’s style guide mandates a little bit more than just
whitespace and bracket position (e.g. that overloaded methods/constructors must
not be interrupted by other methods, or that the order of fields and method
must conform to some logical order, i.e. not a chronological order) most of the
code must be manually checked and potentially corrected.
I wouldn’t really touch the existing source code immediately but make sure that
a) new source code conforms to the style guide, and b) touched code is
reformatted: at least edited methods should be reformatted, preferrable after
the “real” commit so that functional changes are not lost in the formatting. If
the whole file is rather easy to adapt to the new style, the whole file can be
changed, too.
Thoughts, suggestions, opinions?
Greetings,
Bombe
[1]: https://github.com/freenet/fred/pull/298/
[2]: http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
[3]: https://google-styleguide.googlecode.com/svn/trunk/javaguide.html
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Devl mailing list [email protected] https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
