You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Jon Scott Stevens <jo...@latchkey.com> on 2002/01/04 02:54:20 UTC

More abuse of coding styles...

It is amazing to me...with all the discussion about coding styles and
following them, we still have people committing code that doesn't follow
what rules we do have...

on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:

Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
SimpleLog.java

> +        if(_showtime) {

<http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>

"Variable names should not start with underscore _ or dollar sign $
characters, even though both are allowed."

<http://jakarta.apache.org/site/source.html>

"All Java Language source code in the repository must be written in
conformance to the "Code Conventions for the Java Programming Language as
published by Sun."

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Ted Husted <hu...@apache.org>.
I agree with Jon in that when people agree to become a Committer to a
subproject they agree to follow the rules of that subproject, the
Jakarta project, and the Apache Software Foundation.

As it stands, each subproject is entitled to document their own coding
conventions. When none are specified, then the default Jakarta
guidelines apply. 

I believe that PMC members are obligated to remind people of the rules.
It is up to the Committers to a subproject to see that the code is
changed, but it is our job to point out the transgression. (In the same
way that GUMP points out other technical problems.) Of course, other
members of the community are also invited to help us watch our
collective backs. 

Personally, I believe that everyone here is a consummate professional,
or wants to be, and following the coding conventions of your codebase is
a hallmark of professionalism. When I screw up, I certainly want someone
to point it out to me, as Jon has started to do. A word to wise should
be sufficient.

As Sam mentioned, it is unlikely that the PMC or ASF is going to shut
down a codebase for not following their conventions. But we should
exercise our obligation to nag people until the commits come into
compliance or the conventions for the subproject are amended. 

AFAIK, a change to a subproject coding conventions would be a Product
Change.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Jon Scott Stevens wrote:
> 
> It is amazing to me...with all the discussion about coding styles and
> following them, we still have people committing code that doesn't follow
> what rules we do have...
> 
> on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
> 
> Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
> SimpleLog.java
> 
> > +        if(_showtime) {
> 
> <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
> 
> "Variable names should not start with underscore _ or dollar sign $
> characters, even though both are allowed."
> 
> <http://jakarta.apache.org/site/source.html>
> 
> "All Java Language source code in the repository must be written in
> conformance to the "Code Conventions for the Java Programming Language as
> published by Sun."
> 
> -jon
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/4/02 8:05 AM, "Bob Jamison" <rj...@lincom-asg.com> wrote:

> jakarta.apache.org != Sun

That isn't the comparison that we are making here.

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Bob Jamison <rj...@lincom-asg.com>.
Jon Scott Stevens wrote:

><http://jakarta.apache.org/site/source.html>
>
>"All Java Language source code in the repository must be written in
>conformance to the "Code Conventions for the Java Programming Language as
>published by Sun."
>
>-jon
>


"Sun"  ?   ;-)

I thought it was agreed a long time ago that

jakarta.apache.org != Sun

and that

xml.apache.org != IBM

Every time I have seen a discussion about coding styles, it is never
with an altruistic bent.  No one ever says "I should change my coding
style to be more like yours."   No, it is always "You should change
your style to be more like mine."

If someone writes clean, elegant code, it doesn't really matter
if it's K&R style or Whitesmith's style.  If we had Michaelangelo
working here,  I really don't think that we would care if he were
using marble or alabaster,  the result would be magnificent enough.










--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Jeff Turner <je...@socialchange.net.au>.
On Thu, Jan 03, 2002 at 05:54:20PM -0800, Jon Scott Stevens wrote:
> It is amazing to me...with all the discussion about coding styles and
> following them, we still have people committing code that doesn't follow
> what rules we do have...
> 
> on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
> 
> Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
> SimpleLog.java
> 
> > +        if(_showtime) {

We had that discussion once on Commons, and many people liked the
underscore convention.

> <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
> 
> "Variable names should not start with underscore _ or dollar sign $
> characters, even though both are allowed."
> 
> <http://jakarta.apache.org/site/source.html>
> 
> "All Java Language source code in the repository must be written in
> conformance to the "Code Conventions for the Java Programming Language as
> published by Sun."

Maybe that's what needs changing.. I'd suggest:

"All Java source code _should_ follow the existing conventions
established by that project's committers. Projects are strongly
encouraged to follow the "Code Conventions for the Java Programming
Language" as published by Sun."

Perhaps adding:

"Projects whose coding conventions deviate from the Sun standard must
document the changes, with justifications."

Simply because justifications are always fun to read :)


--Jeff

> -jon
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Arnaud Vandyck <ar...@ulg.ac.be>.
Jon Scott Stevens <jo...@latchkey.com> wrote:

> It is amazing to me...with all the discussion about coding styles and
> following them, we still have people committing code that doesn't follow
> what rules we do have...
> 
> on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
> 
> Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
> SimpleLog.java
> 
> > +        if(_showtime) {
> 
> <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
> 
> "Variable names should not start with underscore _ or dollar sign $
> characters, even though both are allowed."

Sun Certified Programmer for Java2 Platform:

Question:

5. Which is a valid identifier? 

o false
o default
o _object
o a-class

funny! :))  allowed, not recommended, but  a part of  the questions at
the exam :)

-- Arnaud, STE-Formations Informatiques, fapse, ULg, .BE

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Jeff Turner <je...@socialchange.net.au>.
On Thu, Jan 03, 2002 at 05:54:20PM -0800, Jon Scott Stevens wrote:
> It is amazing to me...with all the discussion about coding styles and
> following them, we still have people committing code that doesn't follow
> what rules we do have...
> 
> on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
> 
> Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
> SimpleLog.java
> 
> > +        if(_showtime) {

We had that discussion once on Commons, and many people liked the
underscore convention.

> <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
> 
> "Variable names should not start with underscore _ or dollar sign $
> characters, even though both are allowed."
> 
> <http://jakarta.apache.org/site/source.html>
> 
> "All Java Language source code in the repository must be written in
> conformance to the "Code Conventions for the Java Programming Language as
> published by Sun."

Maybe that's what needs changing.. I'd suggest:

"All Java source code _should_ follow the existing conventions
established by that project's committers. Projects are strongly
encouraged to follow the "Code Conventions for the Java Programming
Language" as published by Sun."

Perhaps adding:

"Projects whose coding conventions deviate from the Sun standard must
document the changes, with justifications."

Simply because justifications are always fun to read :)


--Jeff

> -jon
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Craig R. McClanahan" <cr...@apache.org> writes:

> On Fri, 4 Jan 2002, Erik Hatcher wrote:
>
>> Date: Fri, 4 Jan 2002 19:27:52 -0500
>> From: Erik Hatcher <ja...@ehatchersolutions.com>
>> Reply-To: Jakarta General List <ge...@jakarta.apache.org>
>> To: Jakarta General List <ge...@jakarta.apache.org>
>> Subject: Re: More abuse of coding styles...
>>
>> Rule #1 from The Elements of Java Style is:
>>
>>     Adhere to the style of the original
>>
>
> IIRC, we actually had this rule explicitly in the JServ code conventions
> ... looks like it didn't make the transition into the Jakarta docs though.

I am willing to make the xdocs change.  Anyone opposed?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Ted Husted <hu...@apache.org>.
Any time we want switch from Sun's conventions to the Elements of Java
Style, my +1 is cocked and ready. 

"Craig R. McClanahan" wrote:
> 
> On Fri, 4 Jan 2002, Erik Hatcher wrote:
> 
> > Date: Fri, 4 Jan 2002 19:27:52 -0500
> > From: Erik Hatcher <ja...@ehatchersolutions.com>
> > Reply-To: Jakarta General List <ge...@jakarta.apache.org>
> > To: Jakarta General List <ge...@jakarta.apache.org>
> > Subject: Re: More abuse of coding styles...
> >
> > Rule #1 from The Elements of Java Style is:
> >
> >     Adhere to the style of the original
> >
> 
> IIRC, we actually had this rule explicitly in the JServ code conventions
> ... looks like it didn't make the transition into the Jakarta docs though.
> 
> Craig

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 4 Jan 2002, Erik Hatcher wrote:

> Date: Fri, 4 Jan 2002 19:27:52 -0500
> From: Erik Hatcher <ja...@ehatchersolutions.com>
> Reply-To: Jakarta General List <ge...@jakarta.apache.org>
> To: Jakarta General List <ge...@jakarta.apache.org>
> Subject: Re: More abuse of coding styles...
>
> Rule #1 from The Elements of Java Style is:
>
>     Adhere to the style of the original
>

IIRC, we actually had this rule explicitly in the JServ code conventions
... looks like it didn't make the transition into the Jakarta docs though.

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Rule #1 from The Elements of Java Style is:

    Adhere to the style of the original


----- Original Message -----
From: "robert burrell donkin" <ro...@mac.com>
To: "Jakarta General List" <ge...@jakarta.apache.org>
Cc: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Friday, January 04, 2002 12:49 PM
Subject: Re: More abuse of coding styles...


> i'd just like to point out that i didn't write that bit of code (but
> neither did i correct it).
>
> personally speaking, i'm not going to risk having patches vetoed because i
> try to correct the original author's coding style.
>
> any committer who has the time and energy to fight is very welcome to
> correct the many deviations from the standards that you'll find in the
> commons (and in the other projects as well, no doubt).
> - robert
>
> On Friday, January 4, 2002, at 01:54 AM, Jon Scott Stevens wrote:
>
> > It is amazing to me...with all the discussion about coding styles and
> > following them, we still have people committing code that doesn't follow
> > what rules we do have...
> >
> > on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
> >
> > Re: cvs commit: jakarta-
> > commons/logging/src/java/org/apache/commons/logging
> > SimpleLog.java
> >
> >> +        if(_showtime) {
> >
> > <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
> >
> > "Variable names should not start with underscore _ or dollar sign $
> > characters, even though both are allowed."
> >
> > <http://jakarta.apache.org/site/source.html>
> >
> > "All Java Language source code in the repository must be written in
> > conformance to the "Code Conventions for the Java Programming Language
as
> > published by Sun."
> >
> > -jon
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by robert burrell donkin <ro...@mac.com>.
i'd just like to point out that i didn't write that bit of code (but 
neither did i correct it).

personally speaking, i'm not going to risk having patches vetoed because i 
try to correct the original author's coding style.

any committer who has the time and energy to fight is very welcome to 
correct the many deviations from the standards that you'll find in the 
commons (and in the other projects as well, no doubt).
- robert

On Friday, January 4, 2002, at 01:54 AM, Jon Scott Stevens wrote:

> It is amazing to me...with all the discussion about coding styles and
> following them, we still have people committing code that doesn't follow
> what rules we do have...
>
> on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
>
> Re: cvs commit: jakarta-
> commons/logging/src/java/org/apache/commons/logging
> SimpleLog.java
>
>> +        if(_showtime) {
>
> <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
>
> "Variable names should not start with underscore _ or dollar sign $
> characters, even though both are allowed."
>
> <http://jakarta.apache.org/site/source.html>
>
> "All Java Language source code in the repository must be written in
> conformance to the "Code Conventions for the Java Programming Language as
> published by Sun."
>
> -jon
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by ba...@generationjava.com.
> Anyone ever thought of running the code through a code fomatter when the
> nightly build is done?... that'd save all issues and arguments (except
> those of naming conventions).

Have you got good success of using this on a project?

My experience has been that it causes pain in CVS. Instead you'd have to
reformat everything whenever it goes into CVS, but it would still feel odd
as a cvs user.

It pretty much blows CVS diff away?

I guess you could globally set cvs to ignore spaces and tabs etc when it
does diffs.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by ba...@generationjava.com.
Yeah, it's sitting right in front of me :)

On Fri, 4 Jan 2002, Ted Husted wrote:

> A nice alternative to Sun's (a superset really) is the Elements of Java
> Style. Highly recommended.
>
> http://www.amazon.com/exec/obidos/ASIN/0521777682
>
>
> bayard@generationjava.com wrote:
> >
> > > Sigh. That isn't the argument. The argument is about following what
> > > conventions we do have. It could be about coding, voting policies,
> > > whatever...if people ignore the rules, then we shouldn't bother having rules
> > > at all.
> >
> > I'm going through exactly this situation in my new employment. One great
> > reasoning for ignoring the coding convention:
> >
> > "Sun don't obey their coding convention internally. "
> >
> > It seems to me to be a similar reason for why open source Java should use
> > the Apache licence. It's the biggest fish we have to be a littler fish in
> > other seas. My view on the OS Java world has been that the Apache
> > licenced software is in the majority, would be nice to do the maths
> > and see if that's true.
> >
> > Arguing and fragmenting the 'standard' will cause the effectiveness of
> > the community to fail, which is a shame as Sun's conventions, when obeyed,
> > do create relatively homogenous code.
> >
> > Bay
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Ted Husted <hu...@apache.org>.
A nice alternative to Sun's (a superset really) is the Elements of Java
Style. Highly recommended. 

http://www.amazon.com/exec/obidos/ASIN/0521777682


bayard@generationjava.com wrote:
> 
> > Sigh. That isn't the argument. The argument is about following what
> > conventions we do have. It could be about coding, voting policies,
> > whatever...if people ignore the rules, then we shouldn't bother having rules
> > at all.
> 
> I'm going through exactly this situation in my new employment. One great
> reasoning for ignoring the coding convention:
> 
> "Sun don't obey their coding convention internally. "
> 
> It seems to me to be a similar reason for why open source Java should use
> the Apache licence. It's the biggest fish we have to be a littler fish in
> other seas. My view on the OS Java world has been that the Apache
> licenced software is in the majority, would be nice to do the maths
> and see if that's true.
> 
> Arguing and fragmenting the 'standard' will cause the effectiveness of
> the community to fail, which is a shame as Sun's conventions, when obeyed,
> do create relatively homogenous code.
> 
> Bay
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by ba...@generationjava.com.
> Sigh. That isn't the argument. The argument is about following what
> conventions we do have. It could be about coding, voting policies,
> whatever...if people ignore the rules, then we shouldn't bother having rules
> at all.

I'm going through exactly this situation in my new employment. One great
reasoning for ignoring the coding convention:

"Sun don't obey their coding convention internally. "

It seems to me to be a similar reason for why open source Java should use
the Apache licence. It's the biggest fish we have to be a littler fish in
other seas. My view on the OS Java world has been that the Apache
licenced software is in the majority, would be nice to do the maths
and see if that's true.

Arguing and fragmenting the 'standard' will cause the effectiveness of
the community to fail, which is a shame as Sun's conventions, when obeyed,
do create relatively homogenous code.

Bay


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/3/02 9:26 PM, "Arron Bates" <ar...@keyboardmonkey.com> wrote:

> Couldn't we all just agree that arguing about coding convention is like
> bringing up politics and religion at a dinner party?...

Sigh. That isn't the argument. The argument is about following what
conventions we do have. It could be about coding, voting policies,
whatever...if people ignore the rules, then we shouldn't bother having rules
at all.

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Arron Bates <ar...@keyboardmonkey.com>.
Couldn't we all just agree that arguing about coding convention is like 
bringing up politics and religion at a dinner party?...

When you work with a team of developers, you'll end up working amongst 
many styles and preferences, like it or not. Just as long as the big 
ones aren't broken (eg. if blocks without braces, multiple inner classes 
which are actually used in other classes, or inner classes at all 
depending on your religion).

I think the code is suffering more from some editors using tabs, but 
then replaced with spaces, 2 spaces, 4 or eight spaces, back to tabs... 
etc.etc... Just open up the iterate tag or something :)

Anyone ever thought of running the code through a code fomatter when the 
nightly build is done?... that'd save all issues and arguments (except 
those of naming conventions).

There's not enough minutes in our day to be arguing about formatting style.
Bad code is bad code. Good code is good code. Lets just look after that.


Arron.


PS:
+1 for hungarian notation :-D


Donnie Hale wrote:

>Not to be nitpicky, but doesn't Turbine have a coding standard document that
>differs from the "official" Java conventions to which you refer? Not a big
>deal - IIRC, I much prefer Turbine's brace placement vs. the "standard". I
>just thought it interesting you refer to Sun's conventions but are on a
>project with some differences.
>
>Donnie
>
>akarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: More abuse of coding styles...

Posted by Donnie Hale <do...@haleonline.net>.
Jon and Arron,

Like I said - I didn't mean to start any kind of war, religious or
otherwise. :) I agree that tabs in the files are evil. I regularly use the
code beautifier in Visual SlickEdit to see things the way I like them, and
having a code formatter at check-in or build time would be terrific. And I
certainly prefer Jon explicitly documenting the coding standards - all the
Jakarta projects should do the same (preferably using Jon's conventions for
Turbine, since I happen to like them ;).

Donnie


> -----Original Message-----
> From: Jon Scott Stevens [mailto:jon@latchkey.com]
> Sent: Friday, January 04, 2002 2:10 AM
> To: Jakarta Commons Developers List
> Subject: Re: More abuse of coding styles...
>
>
> on 1/3/02 9:04 PM, "Donnie Hale" <do...@haleonline.net> wrote:
>
> > Not to be nitpicky, but doesn't Turbine have a coding standard
> document that
> > differs from the "official" Java conventions to which you
> refer? Not a big
> > deal - IIRC, I much prefer Turbine's brace placement vs. the
> "standard". I
> > just thought it interesting you refer to Sun's conventions but are on a
> > project with some differences.
> >
> > Donnie
>
> Sigh.
>
> Read:
>
> http://jakarta.apache.org/site/source.html
>
> > All Java Language source code in the repository must be written
> in conformance
> > to the "Code Conventions for the Java Programming Language as
> published by
> > Sun. However, some projects may decide to override these
> defaults and use
> > their own defined conventions. For example, the Turbine project
> has its own
> > defined conventions which are similar to the Sun standards but specify
> > slightly different conventions.
>
> At least I bother to document that we use it and that it is
> 'ok'...where is
> it documented in Commons that it is ok to use "_"?
>
> -jon
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/3/02 9:04 PM, "Donnie Hale" <do...@haleonline.net> wrote:

> Not to be nitpicky, but doesn't Turbine have a coding standard document that
> differs from the "official" Java conventions to which you refer? Not a big
> deal - IIRC, I much prefer Turbine's brace placement vs. the "standard". I
> just thought it interesting you refer to Sun's conventions but are on a
> project with some differences.
> 
> Donnie

Sigh. 

Read:

http://jakarta.apache.org/site/source.html

> All Java Language source code in the repository must be written in conformance
> to the "Code Conventions for the Java Programming Language as published by
> Sun. However, some projects may decide to override these defaults and use
> their own defined conventions. For example, the Turbine project has its own
> defined conventions which are similar to the Sun standards but specify
> slightly different conventions.

At least I bother to document that we use it and that it is 'ok'...where is
it documented in Commons that it is ok to use "_"?

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: More abuse of coding styles...

Posted by Donnie Hale <do...@haleonline.net>.
Not to be nitpicky, but doesn't Turbine have a coding standard document that
differs from the "official" Java conventions to which you refer? Not a big
deal - IIRC, I much prefer Turbine's brace placement vs. the "standard". I
just thought it interesting you refer to Sun's conventions but are on a
project with some differences.

Donnie


> -----Original Message-----
> From: Jon Scott Stevens [mailto:jon@latchkey.com]
> Sent: Thursday, January 03, 2002 8:54 PM
> To: Jakarta Commons Developers List
> Cc: general@jakarta.apache.org
> Subject: More abuse of coding styles...
>
>
> It is amazing to me...with all the discussion about coding styles and
> following them, we still have people committing code that doesn't follow
> what rules we do have...
>
> on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
>
> Re: cvs commit:
> jakarta-commons/logging/src/java/org/apache/commons/logging
> SimpleLog.java
>
> > +        if(_showtime) {
>
> <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
>
> "Variable names should not start with underscore _ or dollar sign $
> characters, even though both are allowed."
>
> <http://jakarta.apache.org/site/source.html>
>
> "All Java Language source code in the repository must be written in
> conformance to the "Code Conventions for the Java Programming Language as
> published by Sun."
>
> -jon
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by robert burrell donkin <ro...@mac.com>.
i'd just like to point out that i didn't write that bit of code (but 
neither did i correct it).

personally speaking, i'm not going to risk having patches vetoed because i 
try to correct the original author's coding style.

any committer who has the time and energy to fight is very welcome to 
correct the many deviations from the standards that you'll find in the 
commons (and in the other projects as well, no doubt).
- robert

On Friday, January 4, 2002, at 01:54 AM, Jon Scott Stevens wrote:

> It is amazing to me...with all the discussion about coding styles and
> following them, we still have people committing code that doesn't follow
> what rules we do have...
>
> on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
>
> Re: cvs commit: jakarta-
> commons/logging/src/java/org/apache/commons/logging
> SimpleLog.java
>
>> +        if(_showtime) {
>
> <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
>
> "Variable names should not start with underscore _ or dollar sign $
> characters, even though both are allowed."
>
> <http://jakarta.apache.org/site/source.html>
>
> "All Java Language source code in the repository must be written in
> conformance to the "Code Conventions for the Java Programming Language as
> published by Sun."
>
> -jon
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Berin Loritsch <bl...@apache.org>.
Endre Stølsvik wrote:

> On Thu, 3 Jan 2002, Jon Scott Stevens wrote:
> 
> The _instanceVariable and also the __staticVariable idea makes real good
> sense to me nowadays. Do you have any arguments against it? (btw; this is
> a genuine question!)..


Honestly, I don't like the underscore notation.  If there is any deviation
from that, it would be simple scope modifiers like m_memberVariable.

I have adopted the practice of explicitly scoping all my veriables.  It is
better supported by IDEs with autocompletion, so for me it even reduces
typing.  Also, I try not to ever use a parameter that is the same as a
member variable.


> 
> And while talking about code conventions; people writing like this:
> 
> if (something)
> {
> 
> }


As long as the deviation is *documented*.  If you supercede the Sun
conventions, you must document exactly how it is done.  Examples of
this are in both the Struts and the Avalon projects.  Both clearly
identify coding practices that supercede Sun's conventions.

This also means that *all* Commons code must adopt the coding convention.

Honestly, the aditional space forced by the brace on the following line
_does_ increase legibility.


> 
> should be shot right there on the spot, in the act of typing it.
> 
> The ONLY way to write blocks is like this:
> 
> if (something) {
> 
> }
> 
> 
> ;)
> 
> 



-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/4/02 3:48 AM, "Endre Stølsvik" <En...@Stolsvik.com> wrote:

> On Thu, 3 Jan 2002, Jon Scott Stevens wrote:
> 
> | It is amazing to me...with all the discussion about coding styles and
> | following them, we still have people committing code that doesn't follow
> | what rules we do have...
> |
> | on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
> |
> | Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
> | SimpleLog.java
> |
> | > +        if(_showtime) {
> |
> | <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
> |
> | "Variable names should not start with underscore _ or dollar sign $
> | characters, even though both are allowed."
> 
> The _instanceVariable and also the __staticVariable idea makes real good
> sense to me nowadays. Do you have any arguments against it? (btw; this is
> a genuine question!)..

I used to do that all the time in C++ developent, although I put it at the
end

   membervar_

It really helps, I think.

> 
> And while talking about code conventions; people writing like this:
> 
> if (something)
> {
> 
> }
> 
> should be shot right there on the spot, in the act of typing it.
> 
> The ONLY way to write blocks is like this:
> 
> if (something) {
> 
> }
> 
> 
> ;)


You left out my 'favorite'

  if ( something ) {     }

:)

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"Now what do we do?"


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Endre Stølsvik <En...@Stolsvik.com>.
On Thu, 3 Jan 2002, Jon Scott Stevens wrote:

| It is amazing to me...with all the discussion about coding styles and
| following them, we still have people committing code that doesn't follow
| what rules we do have...
|
| on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
|
| Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
| SimpleLog.java
|
| > +        if(_showtime) {
|
| <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
|
| "Variable names should not start with underscore _ or dollar sign $
| characters, even though both are allowed."

The _instanceVariable and also the __staticVariable idea makes real good
sense to me nowadays. Do you have any arguments against it? (btw; this is
a genuine question!)..

And while talking about code conventions; people writing like this:

if (something)
{

}

should be shot right there on the spot, in the act of typing it.

The ONLY way to write blocks is like this:

if (something) {

}


;)

-- 
Mvh,
Endre


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Endre Stølsvik <En...@Stolsvik.com>.
On Thu, 3 Jan 2002, Jon Scott Stevens wrote:

| It is amazing to me...with all the discussion about coding styles and
| following them, we still have people committing code that doesn't follow
| what rules we do have...
|
| on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
|
| Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
| SimpleLog.java
|
| > +        if(_showtime) {
|
| <http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
|
| "Variable names should not start with underscore _ or dollar sign $
| characters, even though both are allowed."

The _instanceVariable and also the __staticVariable idea makes real good
sense to me nowadays. Do you have any arguments against it? (btw; this is
a genuine question!)..

And while talking about code conventions; people writing like this:

if (something)
{

}

should be shot right there on the spot, in the act of typing it.

The ONLY way to write blocks is like this:

if (something) {

}


;)

-- 
Mvh,
Endre


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Ceki Gülcü <ce...@qos.ch>.
At 10:35 04.01.2002 -0800, you wrote:
>on 1/4/02 3:28 AM, "Ceki Gülcü" <ce...@qos.ch> wrote:
>
>> All Java Language source code in the repository must be written in
>> conformance to the "Code Conventions for the Java Programming Language
>> as published by Sun." However, some projects may decide to override
>> these defaults and use their own defined conventions. For example, the
>> Turbine project has its own defined conventions which are similar to
>> the Sun standards but specify slightly different conventions.
>> 
>> Which really reads: we have conventions but you are free to ignore
>> them -- what people have flocked to do gleefully..
>> 
>> Cheers, Ceki
>
>Keyword above: 'defined'

Fine distinction. Keyword: fine (pun intended).


--
Ceki Gülcü - http://qos.ch



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/4/02 3:28 AM, "Ceki Gülcü" <ce...@qos.ch> wrote:

> All Java Language source code in the repository must be written in
> conformance to the "Code Conventions for the Java Programming Language
> as published by Sun." However, some projects may decide to override
> these defaults and use their own defined conventions. For example, the
> Turbine project has its own defined conventions which are similar to
> the Sun standards but specify slightly different conventions.
> 
> Which really reads: we have conventions but you are free to ignore
> them -- what people have flocked to do gleefully..
> 
> Cheers, Ceki

Keyword above: 'defined'

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: More abuse of coding styles...

Posted by Ceki Gülcü <ce...@qos.ch>.
Hey Jon,

It is not amazing. It is normal. The paragraph that you quoted says:

  All Java Language source code in the repository must be written in
  conformance to the "Code Conventions for the Java Programming Language
  as published by Sun." However, some projects may decide to override
  these defaults and use their own defined conventions. For example, the
  Turbine project has its own defined conventions which are similar to
  the Sun standards but specify slightly different conventions.

Which really reads: we have conventions but you are free to ignore
them -- what people have flocked to do gleefully..

Cheers, Ceki

At 17:54 03.01.2002 -0800, you wrote:
>It is amazing to me...with all the discussion about coding styles and
>following them, we still have people committing code that doesn't follow
>what rules we do have...
>
>on 1/3/02 11:00 AM, "rdonkin@apache.org" <rd...@apache.org> wrote:
>
>Re: cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging
>SimpleLog.java
>
>> +        if(_showtime) {
>
><http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367>
>
>"Variable names should not start with underscore _ or dollar sign $
>characters, even though both are allowed."
>
><http://jakarta.apache.org/site/source.html>
>
>"All Java Language source code in the repository must be written in
>conformance to the "Code Conventions for the Java Programming Language as
>published by Sun."
>
>-jon
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Ceki Gülcü - http://qos.ch



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>