Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 62193 invoked from network); 30 Aug 2009 21:59:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Aug 2009 21:59:14 -0000 Received: (qmail 44183 invoked by uid 500); 30 Aug 2009 21:59:14 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 44102 invoked by uid 500); 30 Aug 2009 21:59:14 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 44094 invoked by uid 99); 30 Aug 2009 21:59:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Aug 2009 21:59:14 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of elecharny@gmail.com designates 209.85.219.209 as permitted sender) Received: from [209.85.219.209] (HELO mail-ew0-f209.google.com) (209.85.219.209) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Aug 2009 21:59:02 +0000 Received: by ewy5 with SMTP id 5so1156207ewy.3 for ; Sun, 30 Aug 2009 14:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=FWijkrtAnDL/VDOasju/XfMzJrjo4QwqDTSsNRgrzJg=; b=k2FshLgUKlqGvcxlPgCXYwIZ7EsDxeT+pOfU5BT9O/ec75woAi35vBO1gpGtlNb8TA OQs+s8TeMwL3nAMVuXMxDSGUX4jAv7+DjXc6O2N5mLZIxJn9rqKagPy8PoJIqsMWCyDn v5NVHc797u8kg27n3qsRoVWzdhaCuelrBUDmA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=cupHl9EsO1TH+20bxvS49pePkp0VJHOtco+DYQaybWfMw6q8pa4w2gHiLOt7cmODRo MfNwGmWbToHeeZu0C5CUdDSd1o1XfyD0kiqXdgwh7WFXsKigrI9oyuI4FeiHRJdpw8sh J2PAuNjjKO8qUkzgg9A4f8JlgneEyipW7y44g= Received: by 10.211.173.16 with SMTP id a16mr4483421ebp.66.1251669522655; Sun, 30 Aug 2009 14:58:42 -0700 (PDT) Received: from ?192.168.0.51? (vol75-3-82-66-216-176.fbx.proxad.net [82.66.216.176]) by mx.google.com with ESMTPS id 24sm843035eyx.39.2009.08.30.14.58.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 30 Aug 2009 14:58:42 -0700 (PDT) Sender: Emmanuel Lecharny Message-ID: <4A9AF617.4060601@nextury.com> Date: Sun, 30 Aug 2009 23:58:47 +0200 From: Emmanuel Lecharny User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: [Code Issues] Don't use toString() to pretty print References: <4A9AD4F5.4060805@nextury.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Alex Karasulu wrote: > OK to be more clear on what I desire: > > We have things like getString() and toString(). Sometimes we have pretty > print functionality in toString(). If you have an object which you want > turned into a string representation toString() might just do the job like > for an Enum or something like that. You basically intuit that you can > toString() the damn thing. Like Value.toString() is the string value. > > If you want to have some extensive pretty print output for debugging and > logging then put that into a getPrettyString() or something like that > instead of toString(). Value or some other object out there like the > SchemaObject and subclasses have the toString() doing a pretty print and I > just wanted the string representation of the value. If I want to pretty > print something then let's just have a toPrettyString() or something very > explicit. Hard to tell if I should use Value.toString() or > Value.getString(). > Well, again, toString() is used for logging or, most important, debugging purpose. In this case, the more we have, the prettier it is, the better. However, as I said, when the String format is very well known, then adding some information is useless (like printing a LdifEntry as something not looking like a LDIF). I insist on the debugging point because the toString() method is what is used by *all* the IDE when you want to watch a variable. getPrettyString() is most certainly not the good thing to use in this case, you can't use it while debugging. -- -- cordialement, regards, Emmanuel L�charny www.iktek.com directory.apache.org