commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [math] UnexpectedNegativeIntegerException
Date Tue, 04 Sep 2012 23:48:13 GMT

> I realize I'm a little late to the party here,

Late or early; these issues pop up again after while... :-)

> so if I'm asking or
> suggesting things that are naive just let me know straight up,
> and I'll try to educate myself better.

There are ideas that sound good we experiment with them within a limited
framework (like a course on programming, for example); and then become a
nightmare when you find yourself constantly trying to get around them.
I mean that a design idea might look nice, and only when you are long way
into implementing the consequences of that idea, you discover that it was
not such a good one after all.

> I will say that I really enjoy reading these threads because I learn a
> great deal from them.

I'm happy to read that.
Certainly, do not hesitate to give your opinion, based on your own

> As a user of commons math I think it would be great if a each exception
> mapped to a "One of a kind problem". So instead of having a
> NegativeIntegerException, which is generic and could be used in a lot
> of places, have SuperDuperOptimizerNegativeIntegerException, which is
> only thrown in one place.
> Is this possible?

Possible, it is. But have you imagined how many different exceptions that
would entail?
Currently, there are more than 1000 "throw" statements in CM.

My position is to have a mapping between "exception type" and "problem
kind"; your suggestion looks like a mapping between "exception type" and
"problem location".
Besides the drawback of an enormous increase of the number of classes, tying
the exception to its place of use is redundant with the information already
provided in the stack trace.

[One of the most useful rules in programming is code reuse; it would be a
waste of a programmer's time to create a new exception class just because
it is intended to be thrown from a different place.]

Best regards,

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

View raw message