Hacker News new | ask | show | jobs
by iampims 1225 days ago
Less options for mixing latitude and longitude?

I personally like static methods.

Point point = Point.fromLonLat(55.25…, 25.20…);

The builder pattern is useful to set defaults and add features without breaking backward compatibility.

2 comments

You can also have cached static instances(assuming immutability), eg Point.fromLonLat(0,0) can always return the same instance, whereas new Point(0,0) must allocate and return a new instance.
> The builder pattern is useful to set defaults and add features without breaking backward compatibility.

Ah, that is interesting. Did not think about that.