OK it's not that big of a deal for me, just a mere annoyance.  I've stated my concerns and you remain adamant on yours.


On Mon, Aug 31, 2009 at 10:23 AM, Emmanuel Lecharny <elecharny@apache.org> wrote:
Alex Karasulu wrote:
I disagree in general with this toString() just being used for logging.
You are right : it's also used for debugging ;)

It's a bad practice that even Josh Bloch should not characterize as only for
logging.  And the reason for this is that the JVM automatically converts a
type to a string representation by calling toString() whenever a string is
Wrong. It generally prints out an @, not a representation of the object. An even if Joshua may be wrong sometime, I think that this usage of toString() is a common practice.

 This is dangerous and one should not presume it's always safe to
just use toString() as an "only for logging output" method that can be
leisurely set to anything u like.
It's not dangerous : it's the contract. There is nothing wrong in producing a String from an objetc, whne it's dangerous to produce a specific format not agreed on before when it's not candy for the user's eye. Again the contract said 'for the person', not for the program.

Sometimes people are surprise when the compiler does the interchange between
the type and the String returned by toString().  I just think any method
that the compiler treats in a special way like this should be considered
Do you have an example ?

Also regarding your point about IDE's using toString(): usually there can be
some alignment but if not you can always setup a custom renderer in the
IDE's debugger.  Most people rarely ever use this feature since they just
dig into the object via the variable viewer.
And I don't want to use this feature. It always is a waste of time to have to open an object to get what's inside it when a well designed toString() method would have produced the exact representation of the object. When you are debugging, you want to get straight to the bug, not to have to tune your IDE for hours to get what you want.

In general, and this is something very true for ADS, lacks of logs and lacks of decent toString() methdos induce long and painfull debugging session. We are debugging this server more than we are writing code, now that we have delivered stable versions, and this is something that won't slow down. In any case, I would favor pretty toString() methods over anything else.

cordialement, regards,
Emmanuel Lécharny

Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org