commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <>
Subject Re: Using internal classes with Digester and XMLRules
Date Wed, 04 Jan 2006 17:09:53 GMT
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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message