On 30 Aug 2006, at 21:22, Andrew Turner wrote:
Andy Armstrong <[EMAIL PROTECTED]> wrote:

Is it not more valuable to have interfaces that are appropriate to
the individual languages? A perlish interface isn't necessarily a
pythonish interface - and neither of them are likely to be anything
like the C or C++ interface to the same functionality. Well, apart
from fairly simple APIs - in which case it seems moot.


I'm thinking more abstractly. General inputs/outputs, config options, etc.
Parse GPX File (file, split_distance, split_time, offset, ...)

Well in Perl I'd want to be able to do something like

my $p = GPX::Parser->new({ merge_tracks => 1, synth_names => 1 });
my $data = $p->parse($some_file, { split_every => 60 });

In Java the same thing might be expressed as

Parser p = new Parser();
p.setMergeTracks(true);
p.setSynthNames(true);
p.splitEvery(60);  // can't set options per parse in Java
GeoData d = p.parse(someFile);

In Obj-C it might be

GPXParser p = [GPXParser parserWithOptions: MERGE_TRACKS | SYNTH_NAMES];
[p setMergeTracks: true]
// etc etc
GPXData d = [p parseFile: someFile];

(all completely made up and untested)

If you're using a language that allows you to avoid long lists of positional arguments you're usually well advised to do so - so standardising function signatures across multiple languages seems like a bit of a retrograde step.

Distance ([lat1, lon1, <alt1>], [lat2, lon2, <alt2>], model)

Yes, but in Java my points are instances of net.hexten.geo.Point (perhaps) and in Perl they might be references to hashes like this:

  my $loc = {
        lat => 57.2,
        lon => -2.3,
        alt => 123     # optional
  };

And in Obj-C they'd likely be something else. And so on for just about every other language that people are likely to be using.

And who benefits if we force all these different languages to use the same function signatures? The majority of developers don't language- hop all that often so the benefit of having a clear, well designed interface that's native to whatever language they're using greatly outweighs any benefit that accrues from being able to call functions the same way in different languages.

...etc...

But maybe that is too specific across languages. At the very least
defining general problem s/patterns, features, and referenced
standards.

Examples please :)

--
Andy Armstrong, hexten.net

_______________________________________________
Geowanking mailing list
[email protected]
http://lists.burri.to/mailman/listinfo/geowanking

Reply via email to