classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposed coding standard updates


From: Archie Cobbs
Subject: Re: Proposed coding standard updates
Date: Fri, 2 Apr 2004 16:41:02 -0600 (CST)

Dalibor Topic wrote:
> > I'd like to propose a couple new extensions to our Java coding
> > standard.
> > 
> > This comes from ZipEntry:
> > 
> >     dostime = (cal.get(cal.YEAR) - 1980 & 0x7f) << 25
> > 
> > Here, `cal' is a local variable and YEAR is a static field in
> > Calendar.  This is valid code, but I find it somewhat confusing; the
> > stuff before "." is evaluated for side effects only.  I'd rather we
> > not use static members with a non-static qualifier, and instead write
> > `Calendar.YEAR'.
> > 
> > I'd also like to get rid of unused `import' statements.
> > 
> > These might just be academic for the time being, I don't know if any
> > current compiler except the one in Eclipse can detect these things.
> > Still, I'd like to update hacking.texinfo and change these constructs
> > when they are found.
> 
> I'd like to add that 1980, 0x7f and 25 could also be replaced by more 
> meaningfully named constants.

FYI,

I've found that this book is a good place to start when trying to
define a set of "accepted" coding conventions:

  https://jjguidelines.dev.java.net/book/html/apa.html

Some projects have defined their coding conventions basically
as a "diff" from the ones defined there.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]