OK proceeding with these changes but will hold back submitting a bit
for more comments.

On Mon, Oct 20, 2008 at 12:06 AM, Ted Dunning <[EMAIL PROTECTED]> wrote:
> No cases that I know of where floats actually help in our code and there are
> bound to be places where they hurt.

I agree, I think this is best.

If the reason was just that Hadoop, shockingly, doesn't have a
DoubleWritable, we can write one (and submit to Hadoop if desired) --
but we can also use FloatWritable too! you lose precision, yes, but
just at the end. It doesn't mean floats should be used everywhere.


> Furthermore, I try to follow the Spring philosophy that if the intermediate
> caller doesn't have much of a chance of fixing the problem, then it should
> be an unchecked exception.
>
> Thus, index out of bounds, numerical instability, bad argument and bad
> encoding cases should be runtime exceptions.  Any code where you find people
> repacking exceptions into runtime exceptions to meet external API
> requirements or where exceptions have to be declared but nobody ever catches
> them except the framework are prime candidates for this treatment.

This is a tangent -- I am not going to modify any exceptions -- but I
suppose I follow a somewhat different rule.

I have always understood RuntimeException to be for situations that
should not happen when the an API is called correctly, in a debugged
program. So, NullPointerException, IllegalArgumentException, etc. are
not checked. It is unreasonable to force the caller to tell you what
happens if it's calling an API wrong.

However anything else, any other situation that can come up in a
correctly-programmed bit of code, should be a checked exception. So I
think stuff like an IOException of SQLException are properly checked
exceptions. You can totally correctly call an HTTP API and still fail
to get a web page if the internet is not available. You *should* be
asked to say what happens if your method invocation can't complete
normally -- or else why have exceptions in the first place? So in that
sense I differ with the Spring/Hibernate theory.

... and that said I do not see any RuntimeExceptions which I think
should be checked exceptions! just a tangent.

Reply via email to