You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2002/01/03 20:00:19 UTC

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

rdonkin     02/01/03 11:00:19

  Modified:    logging/src/java/org/apache/commons/logging SimpleLog.java
  Log:
  This class now inherits from AbstractLog and log level checking is enforced
  
  Revision  Changes    Path
  1.7       +208 -81   jakarta-commons/logging/src/java/org/apache/commons/logging/SimpleLog.java
  
  Index: SimpleLog.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/SimpleLog.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SimpleLog.java	4 Dec 2001 04:28:03 -0000	1.6
  +++ SimpleLog.java	3 Jan 2002 19:00:19 -0000	1.7
  @@ -1,11 +1,65 @@
   /*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  + * $Header: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/SimpleLog.java,v 1.7 2002/01/03 19:00:19 rdonkin Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/01/03 19:00:19 $
  + *
  + * ====================================================================
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
    *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE file.
    */
   
  +
   package org.apache.commons.logging;
   
   import java.util.Properties;
  @@ -23,7 +77,7 @@
    * <li><code>org.apache.commons.logging.simplelog.defaultlog</code> -
    *     Default logging detail level for all instances of SimpleLog.
    *     Must be one of ("debug", "info", "warn", "error", or "fatal").
  - *     If not specified, defaults to "error".</li>
  + *     If not specified, defaults to "error". </li>
    * <li><code>org.apache.commons.logging.simplelog.log.xxxxx</code> -
    *     Logging detail level for a SimpleLog instance named "xxxxx".
    *     Must be one of ("debug", "info", "warn", "error", or "fatal").
  @@ -42,16 +96,32 @@
    * from this resource (if it exists).</p>
    *
    * @author Rod Waldhoff
  - * @version $Id: SimpleLog.java,v 1.6 2001/12/04 04:28:03 craigmcc Exp $
  + * @author Robert Burrell Donkin
  + *
  + * @version $Id: SimpleLog.java,v 1.7 2002/01/03 19:00:19 rdonkin Exp $
    */
  -public class SimpleLog implements Log {
  +public class SimpleLog extends AbstractLog {
  +
  +    // --------------------------------------------------------- Class Attributes
  +    
  +    /** All system properties used by <code>Simple</code> start with this */
       static protected final String _prefix =
           "org.apache.commons.logging.simplelog.";
  +    
  +    /** All system properties which start with {@link #_prefix} */
       static protected final Properties _simplelogProps = new Properties();
  +    /** Include the instance name in the log message? */
       static protected boolean _showlogname = false;
  +    /** Include the current time in the log message */
       static protected boolean _showtime = false;
  +    /** Used to format times */
       static protected DateFormat _df = null;
   
  +
  +
  +    // --------------------------------------------------------- Initializer
  +
  +    // initialize class attributes
       static {
           // add all system props that start with the specified prefix
           Enumeration enum = System.getProperties().propertyNames();
  @@ -73,29 +143,50 @@
                   // ignored
               }
           }
  +        
           try {
           } catch(Throwable t) {
               // ignored
           }
  -        _showlogname = "true".equalsIgnoreCase(_simplelogProps.getProperty(_prefix + "showlogname","true"));
  -        _showtime = "true".equalsIgnoreCase(_simplelogProps.getProperty(_prefix + "showdate","true"));
  +        
  +        _showlogname = "true".equalsIgnoreCase(
  +                _simplelogProps.getProperty(
  +                    _prefix + "showlogname","true"));
  +                    
  +        _showtime = "true".equalsIgnoreCase(
  +                _simplelogProps.getProperty(
  +                    _prefix + "showdate","true"));
  +                    
           if(_showtime) {
  -            _df = new SimpleDateFormat(_simplelogProps.getProperty(_prefix + "dateformat","yyyy/MM/dd HH:mm:ss:SSS zzz"));
  +            _df = new SimpleDateFormat(
  +                _simplelogProps.getProperty(
  +                    _prefix + "dateformat","yyyy/MM/dd HH:mm:ss:SSS zzz"));
           }
       }
   
  -    protected static final int DEBUG  = 5;
  -    protected static final int INFO   = 4;
  -    protected static final int WARN   = 3;
  -    protected static final int ERROR  = 2;
  -    protected static final int FATAL  = 1;
  -    protected int _logLevel = 2;
   
  +    // --------------------------------------------------------- Attributes
  +
  +    /** The name of this simple log instance */
       protected String _name = null;
   
  +
  +    // --------------------------------------------------------- Constructor
  +    
  +    /** 
  +     * Construct a simple log with given name.
  +     *
  +     * @param name log name
  +     */
       public SimpleLog(String name) {
  +    
           _name = name;
   
  +        // set initial log level
  +        // set default log level to ERROR
  +        setLevel(Log.ERROR);
  +        
  +        // set log level from properties
           String lvl = _simplelogProps.getProperty(_prefix + "log." + _name);
           int i = String.valueOf(name).lastIndexOf(".");
           while(null == lvl && i > -1) {
  @@ -103,104 +194,140 @@
               lvl = _simplelogProps.getProperty(_prefix + "log." + name);
               i = String.valueOf(name).lastIndexOf(".");
           }
  +        
           if(null == lvl) {
               lvl =  _simplelogProps.getProperty(_prefix + "defaultlog");
           }
   
           if("debug".equalsIgnoreCase(lvl)) {
  -            _logLevel = DEBUG;
  +            setLevel(Log.DEBUG);
           } else if("info".equalsIgnoreCase(lvl)) {
  -            _logLevel = INFO;
  +            setLevel(Log.INFO);
           } else if("warn".equalsIgnoreCase(lvl)) {
  -            _logLevel = WARN;
  +            setLevel(Log.WARN);
           } else if("error".equalsIgnoreCase(lvl)) {
  -            _logLevel = ERROR;
  +            setLevel(Log.ERROR);
           } else if("fatal".equalsIgnoreCase(lvl)) {
  -            _logLevel = FATAL;
  +            setLevel(Log.FATAL);
           }
       }
   
  +
  +    // --------------------------------------------------------- Methods
  +    
  +    /**
  +     * <p> Do the actual logging.
  +     * This method assembles the message 
  +     * and then prints to <code>System.out</code>.</p>
  +     */
       protected void log(int type, Object message, Throwable t) {
  -        if(_logLevel >= type) {
  -            StringBuffer buf = new StringBuffer();
  -            if(_showtime) {
  -                buf.append(_df.format(new Date()));
  -                buf.append(" ");
  -            }
  -            switch(type) {
  -                case DEBUG: buf.append("[DEBUG] "); break;
  -                case INFO:  buf.append("[INFO] ");  break;
  -                case WARN:  buf.append("[WARN] ");  break;
  -                case ERROR: buf.append("[ERROR] "); break;
  -                case FATAL: buf.append("[FATAL] "); break;
  -            }
  -            if(_showlogname) {
  -                buf.append(String.valueOf(_name)).append(" - ");
  -            }
  -            buf.append(String.valueOf(message));
  -            if(t != null) {
  -                buf.append(" <");
  -                buf.append(t.toString());
  -                buf.append(">");
  -                t.printStackTrace();
  -            }
  -            System.out.println(buf.toString());
  +        // use a string buffer for better performance 
  +        StringBuffer buf = new StringBuffer();
  +        
  +        // append date-time if so configured
  +        if(_showtime) {
  +            buf.append(_df.format(new Date()));
  +            buf.append(" ");
           }
  +        
  +        // append a readable representation of the log leve
  +        switch(type) {
  +            case DEBUG: buf.append("[DEBUG] "); break;
  +            case INFO:  buf.append("[INFO] ");  break;
  +            case WARN:  buf.append("[WARN] ");  break;
  +            case ERROR: buf.append("[ERROR] "); break;
  +            case FATAL: buf.append("[FATAL] "); break;
  +        }
  +        
  +        // append the name of the log instance if so configured
  +        if(_showlogname) {
  +            buf.append(String.valueOf(_name)).append(" - ");
  +        }
  +        
  +        // append the message
  +        buf.append(String.valueOf(message));
  +        
  +        // append stack trace if not null
  +        if(t != null) {
  +            buf.append(" <");
  +            buf.append(t.toString());
  +            buf.append(">");
  +            t.printStackTrace();
  +        }
  +        
  +        // print to System.out
  +        System.out.println(buf.toString());
       }
   
  -    public final void debug(Object message) {
  -        log(DEBUG,message,null);
  -    }
  -
  -    public final void debug(Object message, Throwable t) {
  -        log(DEBUG,message,t);
  -    }
  +    // --------------------------------------------------------- Log Implementation
   
  -    public final void info(Object message) {
  -        log(INFO,message,null);
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void debugImpl(Object message) {
  +        log(Log.DEBUG,message,null);
       }
   
  -    public final void info(Object message, Throwable t) {
  -        log(INFO,message,t);
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void debugImpl(Object message, Throwable t) {
  +        log(Log.DEBUG,message,t);
       }
   
  -    public final void warn(Object message) {
  -        log(WARN,message,null);
  -    }
  -    public final void warn(Object message, Throwable t) {
  -        log(WARN,message,t);
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void infoImpl(Object message) {
  +        log(Log.INFO,message,null);
       }
   
  -    public final void error(Object message) {
  -        log(ERROR,message,null);
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void infoImpl(Object message, Throwable t) {
  +        log(Log.INFO,message,t);
       }
   
  -    public final void error(Object message, Throwable t) {
  -        log(ERROR,message,t);
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void warnImpl(Object message) {
  +        log(Log.WARN,message,null);
       }
  -
  -    public final void fatal(Object message) {
  -        log(FATAL,message,null);
  -    }
  -
  -    public final void fatal(Object message, Throwable t) {
  -        log(FATAL,message,t);
  +    
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void warnImpl(Object message, Throwable t) {
  +        log(Log.WARN,message,t);
       }
   
  -    public final boolean isDebugEnabled() {
  -        return (_logLevel >= DEBUG);
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void errorImpl(Object message) {
  +        log(Log.ERROR,message,null);
       }
   
  -    public final boolean isInfoEnabled() {
  -        return (_logLevel >= INFO);
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void errorImpl(Object message, Throwable t) {
  +        log(Log.ERROR,message,t);
       }
   
  -    public final void setLevel(int level) {
  -        _logLevel = level;
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void fatalImpl(Object message) {
  +        log(Log.FATAL,message,null);
       }
   
  -    public final int getLevel() {
  -        return _logLevel;
  +    /**
  +     * Prepare then call {@link #log}.
  +     */
  +    protected final void fatalImpl(Object message, Throwable t) {
  +        log(Log.FATAL,message,t);
       }
  -
   }
  
  
  

--
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>


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 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 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 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>


More abuse of coding styles...

Posted by Jon Scott Stevens <jo...@latchkey.com>.
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>


More abuse of coding styles...

Posted by Jon Scott Stevens <jo...@latchkey.com>.
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>