Quote (carteblanche @ Nov 8 2014 12:09am)
hmm i'd make it public. if i want a Fraction object to represent 10/100, i'm not sure i want it to auto reduce to 1/10 from the constructor. i'd only want it to auto reduce after performing arithmetic. maybe have a setting for it.
http://onemangaforums.com/public/style_emoticons/default/shrug.gifthen again, i'm not sure i don't want it to auto reduce from the constructor either. not sure what the downsides are. thats just how apache commons does it iirc, but that's because their equals doesn't first reduce both fractions.
Very valid points. I guess it would depend on the implementation requirements. If we are required to always keep it in reduced form then I would make it private and auto reduce in the constructor. Otherwise, maybe making it public and let the consumer decide how to represent the data, reduced or not.