commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [lang] [math] org.apache.commons.lang.math.Fraction class
Date Thu, 03 Jun 2004 21:16:03 GMT
From: "C. Scott Ananian" <cscott@cscott.net>
> On Thu, 3 Jun 2004, Stephen Colebourne wrote:
> > I had a 5 second look yesterday, and realised how big the change is. My
> > immediate concern is that the Fraction class has lost its final status,
> > making it less immutable.
>
> The idea is to remove the deprecated methods in some future version of
> lang; at which point Fraction can be made final again (and BadFraction
> completely disappears).  It would be harder to purge BadFraction if its
> code is mixed willy-nilly with the 'real' Fraction code.
This presumes that everyone wants a reduced fraction. I believe that there
are use cases for holding an unreduced one. The main one that strikes me is
education.

Somewhere along the line I've lost the reason why we should deprecate
unreduced fractions. They are a valid representation of a fraction (so long
as the internal calculations are done properly), so why not allow them?

BTW, the 2/4 != 1/2 is consistent with the JDK - classes like BigDecimal
IIRC will have similar 'odd' behaviour, eg 0.500 != 0.5.

> The constructor for Fraction is package-private (or should be!) so no one
> outside the lang package can create a subclass in any case.
I hadn't noticed that, so the final is not an issue.

Stephen


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


Mime
View raw message