On Wed, Feb 02, 2011 at 08:57:10AM +0000, Stephen Colebourne wrote:
> On 2 February 2011 00:12, Gilles Sadowski <gil...@harfang.homelinux.org> 
> wrote:
> >> Here is a probably too simple example:
> >>
> >> com.example defines IOException
> >> com.example.input uses IOException
> >> com.example.output uses IOException
> >
> > Well, I don't see that as obviously better than storing all exceptions in an
> > "exception" package. I find the latter tidier.
> >
> > The problems arises when one thinks that some exception is only needed in
> > one package:
> >  com.example.foo uses and defines FooException
> > Then one discovers
> >  com.example.bar also uses FooException
> >
> > Add a few more exceptions and soon people are searching the exceptions
> > definitions all over the place, or create new ones that duplicate
> > functionality that already exists in some other package.
> 
> I too would consider an exceptions package bad practice. Exceptions
> should be located in the highest level package that they might be used
> from. "tidiness" is generally a bad metric for organising package
> structure.

"Bad practice", "bad metric"; I don't think so. They can be used all the
same when defined in a package called "exception", just as we also have a
package called "util" where there is a "MathUtils" class containing
functions that are potentially useful everywhere in the CM code. By the same
token, you would have it placed at the top-level.
In fact, it's more a matter of (possibly bad) taste, than a design issue.


Regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to