On Thu, 1 Feb 2018 10:41:58 -0700, Gary Gregory wrote:
On Thu, Feb 1, 2018 at 9:59 AM, Stephen Colebourne <scolebou...@joda.org>
wrote:

On 1 February 2018 at 15:30, Gary Gregory <garydgreg...@gmail.com> wrote: > For example, (picking a made up example) this reads really well to me:
> Pair.of(foo, bar) because that what you'd use in spoken English.
>
> OTOH, this does not read well to me: Fraction.of(num, denum); this would
be
> better: Fraction.from(num, denum)

In JSR-310, of() is used when there is little work performed in the
factory, and relatively low chance of an error. from() is used when
performing a complex conversion, that has a higher chance of failure,


I like that. To me from() implies some sort of conversion, and of() a
simple construction.


Isn't the difference between those an "implementation detail"?
What if the implementation changes?  E.g. we add fields and what
was a "conversion" becomes a "simple" construction...

IMO a consistent naming is valuable in itself.
If a developer is worried about performance hits of (from?)
"conversion", there is always the source. :-)

Note that in this particular case of "Complex", the proposed
"of" methods imply little work and low risk of failure (which
would result from a programming error).

Gilles


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

Reply via email to