Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 68050 invoked from network); 5 Jan 2006 07:59:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jan 2006 07:59:51 -0000 Received: (qmail 2072 invoked by uid 500); 5 Jan 2006 07:59:46 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 1854 invoked by uid 500); 5 Jan 2006 07:59:45 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 1843 invoked by uid 99); 5 Jan 2006 07:59:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jan 2006 23:59:45 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [210.86.15.158] (HELO avmta3-rme.xtra.co.nz) (210.86.15.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jan 2006 23:59:44 -0800 Received: from mta2-rme.xtra.co.nz ([210.86.15.192]) by avmta3-rme.xtra.co.nz with ESMTP id <20060105075932.EGDM2765.avmta3-rme.xtra.co.nz@mta2-rme.xtra.co.nz> for ; Thu, 5 Jan 2006 20:59:32 +1300 Received: from [10.1.1.5] ([222.152.245.209]) by mta2-rme.xtra.co.nz with ESMTP id <20060105075931.QIFU18564.mta2-rme.xtra.co.nz@[10.1.1.5]> for ; Thu, 5 Jan 2006 20:59:31 +1300 Subject: Re: Using internal classes with Digester and XMLRules From: Simon Kitching Reply-To: skitching@apache.org To: Jakarta Commons Users List In-Reply-To: <224f32340601040909q30acc209t42226fa212976d28@mail.gmail.com> References: <36569.170.201.180.136.1136389798.squirrel@webmail.chiron.lunarpages.com> <200601041602.k04G2jON005295@home.hyperworx.com> <51669.170.201.180.136.1136391017.squirrel@webmail.chiron.lunarpages.com> <224f32340601040909q30acc209t42226fa212976d28@mail.gmail.com> Content-Type: text/plain Date: Thu, 05 Jan 2006 20:59:50 +1300 Message-Id: <1136447990.4668.13.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Wed, 2006-01-04 at 18:09 +0100, Thomas Dudziak wrote: > On 1/4/06, Frank W. Zammetti wrote: > > > Anyone else, just out of curiosity, is there a "best practice" around > > this? My feeling is that if I'm configuring an object that is only used > > by a given class, i.e., Class foo has a collection of Class bar's that > > will be created via Digester, and nothing outside foo uses bar, and then > > making bar an inner class makes it a bit more obvious to me what its > > purpose is and how it fits into the object schema, so to speak... although > > one could argue that it represents coupling and therefore is bad... any > > thoughts? > > You should use inner classes (non-static) only if they have a real > tight coupling to the outer class, i.e. if they always need a outside > instance (think: almost every method of the inner class would > otherwise need an object of the outer class as parameter). > Whether you prefer nested (static) classes or normal classes in the > same package might depend on whether the nested class needs access to > internals of the outer class (private methods) though one could argue > that this is not a good design. > > Other than that it is probably a matter of personal style. But I tend > to avoid static classes for the sole reason that they make the class > bigger and less readable. Non-static inner classes are of course very useful as "adapters" which implement some interface and map it onto methods of the enclosing class. I generally find them nicer than anonymous classes, though anonymous classes are appropriate in some cases. I agree with you both on all the other points. Cheers, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org