commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Waldhoff, Rodney" <rwald...@us.britannica.com>
Subject RE: [Latka] Developer's Guide / Coding Style
Date Fri, 22 Mar 2002 16:09:06 GMT
> One could question if there isn't anything wrong with the naming of the
> methods. Do you have an example of such a scenario that we could use to
> discuss?

Here's an example of what I'm talking about:

public class PooledConnection extends Connection {
    public PooledConnection(Connection delegate) {
        _delegate = delagate;
    }

    public void someMethod() throws SQLException {
        _delegate.someMethod();
    }

    public void close() throws SQLException {
       _sourcePool.returnObject(this);
    }

    private void _close() throws SQLException {
       _delegate.close();
    }

    private Connection _delegate = null;
    private Pool _sourcePool = null;
}

If you're really in tune with an underscore-prefix-on-private-members
convention, that's pretty readable--it's clear that _close() is the private
form of close().  

But I won't try to defend it.  I agree with you. (E.g., in this situation in
dbcp, we used "reallyClose()" in place of "_close()".)  A scenario in which
this would be useful would happen rarely if ever.  That was my whole point,
I don't think it should be considered conventional, and I don't think anyone
has really ever claimed it to be so. (But the Latka coding style doc does.)

-----Original Message-----
From: ringo.desmet@mediagenix.com [mailto:ringo.desmet@mediagenix.com]
Sent: Friday, March 22, 2002 9:52 AM
To: commons-dev@jakarta.apache.org
Subject: RE: [Latka] Developer's Guide / Coding Style


   
> > private methods also begin with an underscore
> 
> I think I've been known to do this on rare occasions (mainly 
> when there is
> some public method and protected/private method with an 
> otherwise identical
> signature) but I wouldn't claim it to be "conventional" in 
> any sense of the word.

One could question if there isn't anything wrong with the naming of the
methods. Do you have an example of such a scenario that we could use to
discuss?

Ringo

--
To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message