Question

I want to implement, for personal use, an object representing a structured collection of GPS data.

Currently, there are a lot of file formats to represent this data, all of them with some minor variation of this representation:

  • A trackpoint would be a 4 element tuple representing the fixed-ordered sequence (latitude, longitude, elevation, timestamp).
  • A tracksegment is a sequence (ordered collection) of trackpoints, ordered by timestamp, representing a continuous line.
  • A track is an ordered collection of tracksegments, ordered by "creation timestamp", representing a discontinuous line (or multiple continuous lines in a given order).

My question is: "from a object-oriented design good-practices point of view, how should I name a class to represent a (not necessarily ordered) COLLECTION OF TRACKS"?

For example, suppose I have a GPX file, a KML file and I want to save both to a single JSON file, the API calls would be:

kmldata = new GPS_Data("somefile.kml");
gpxdata = new GPS_Data("somefile.gpx");
merged = GPS_Lib.merge(kmldata, gpxdata);
merged.save_to_json("somefile.json");

I feel that "GPS_Data" is too broad. Also, this would be the structure usually serialized to a file, but "GPS_File" refers too much to implementation of persistence, but this is an incidental use of the object (serialization to disk), not the definition of it.

Était-ce utile?

La solution

Usually you store tracks in a List of Track.
So you can call it Tracks or TrackList.

More generally, you simply use the plural word for the element of that collection: singular: "track" plural "tracks"

In java this would be

List<Track> tracks.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top