Tuesday, July 23, 2013

Java Code Conventions from the last century

I find it very helpful that Java Code Conventions exist for a long time now. They really "improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly" (from the Code Conventions web page).

But while the Java language evolves the code conventions remain the same. Since the Java Code Conventions were last updated in 1999 several new Java language features were introduced including lambdas in the upcoming version of Java 8.

Would it not be nice to update the Code Conventions so that we do not need to follow rules from the last century in Java 8 (which are not bad but probably missing relevant parts)?

I wondered where the best place for an enhancement request for this would be and asked some Java people on Twitter:

Luckily Dalibor Topic suggested to bring this topic on at the OpenJDK discuss mailing list. And so I did. You can find my mail here. Feel free to take part in the discussion


Update 2013-08-08

I noticed that there are two (very) old bug reports related to the Code Conventions topic (see below). Both are closed with the "Won't fix" resolution. I now wonder whether the Java Code Conventions document is to be kept up to date at all. If not it would be better to mark it as deprecated and point to alternative (up-to-date) resources (if they exist) IMHO.

JDK-4785435 : bugs in CodeConventions on java.sun.com/docs/codeconv

last comment (2002-12-17):

    We no longer support this document, for it has been replaced by
    Josh Bloch's book "Effective Java". This document served its purpose
    when no other existed, but it has reached the end of its life.

JDK-4797268 : Code conventions need to be updated

last comment (2009-07-30):

    Yes, we do need an updated code conventions doc.