[ https://issues.apache.org/jira/browse/NUMBERS-123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16877301#comment-16877301 ]
Gilles commented on NUMBERS-123: -------------------------------- The point about whether or not to put that code in a constructor is IMHO quite moot since we adopted the ValJO convention (i.e. define factory methods and make any and all constructors private). Then following that ValJO path, a distinction is made between direct assignment ("of") and conversion ("from"). IMO, a single constructor is clearer because we can say *once* that either the constructor will do the reduction, or that the caller (i.e. one of the conversion methods) is responsible for doing it (and can thus set the flag to {{false}}). If you are still convinced that your viewpoint is more sensible, please post to the ML, asking for more opinions. > "BigFraction(double)" is unnecessary > ------------------------------------ > > Key: NUMBERS-123 > URL: https://issues.apache.org/jira/browse/NUMBERS-123 > Project: Commons Numbers > Issue Type: Improvement > Components: fraction > Reporter: Gilles > Assignee: Gilles > Priority: Trivial > Fix For: 1.0 > > Attachments: NUMBERS-123__Javadoc.patch > > Time Spent: 0.5h > Remaining Estimate: 0h > > Constructor {{BigFraction(double value)}} is only called from the > {{from(double value)}} method. > Actually, this constructor is misleading as it is indeed primarily a > conversion from which appropriate {{numerator}} and {{denominator}} fields > are computed; those could be set by > the "direct" constructor {{BigFraction(BigInteger num, BigInteger den)}}. > Moreover, the private field {{ZERO}} goes through this conversion code > whereas it could constructed "directly", e.g. using {{of(0)}}. Similarly for > field {{ONE}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)