phpgeo
phpgeo copied to clipboard
Coordinate class naming
Hi, I was doing a little bit of domain research for a side project of mine, and I noticed your library: it looks nice! :) While reading the code, I noticed the "Coordinate" class and wondered if it shouldn't be named "Coordinates" (plural) as it represents a pair of coordinates(latitude and longitude, plus an ellipsoid). Sorry for opening an issue for a single character, but I thought it could've been a possible item for the next major release. Thanks!
Hi!
Thanks for your comment. I thought a lot about the naming of the class myself and came to the conclusion to change it into something more common. My current favorite name is Point :-)
I see.. I definitely see a use for a Point class(as well as other shapes, such a Polyline and a Radius, for example), but I'd keep coordinates within those. jm2c ofc :) Thanks for the quick reply! :)
Stellar library @mjaschen! 💪 Chiming in because I love these types of discussions because I always learn something.
@omissis: Thoughts on below?
Point(float $position)PointPair(Point $latitude, Point $longitude)Coordinate(PointPair $points, Ellipsoid $ellipsoid = null)
I'm 👎 for Coordinates (plural) because that would imply a collection of Coordinate objects (to me, anyway).
Hi,
I just pushed the first commit to the 4.0 milestone. The Coordinate class was renamed to Point. I don't have a due date for this milestone yet, probably sometime later in 2020.
The 4.0 change log can be found here: https://github.com/mjaschen/phpgeo/blob/milestone/4.0/CHANGELOG.md
@bmeynell sorry to get to answer your question so late! I'd be more for Coordinates as it's how someone would commonly use the term (think telling someone "tell me your coordinates": the result will be made of a latitude and a longitude). I understand the "Coordinates make me think of an array of Coordinate" kind of thinking, but I would dispute that's how (some/most) programmers think(so there's a clear bias): that's not necessarily bad(the library is for programmers after all), but it's not how the term is used in its original context.