Andrew Lentvorski <[EMAIL PROTECTED]> writes:
> Programming today consists mostly of plugging API's together with
> some glue code.
Yes, I've been doing some of that recently myself, this time in
Java. It seems easy at first to build on (non-standard) libraries, but
then there are a lot of mailing lists to track, communities to
monitor, bugs to investigate, and hence source trees to experiment
with. Having libraries available gives one a headstart, but it doesn't
all just work right out of the box.
Also, some of the standard libraries are nice in interface, but
peeking at the implementation reveals a lot of sloppy work and missed
opportunities.¹ But I always have to pause and worry, "If I (re)write
it myself, someone will come along later and wonder what kind of idiot
didn't know about [some standard class or function]."
> A language in which that is difficult is a *big* lose rather than a
> small lose. Foreign function interface incompatibilities are a big
> headache.
True. You're probably familiar with CFFI¹, which helps, but it's too
young -- still usurping UFFI -- to declare victory.
Footnotes:
¹ Obligatory example: java.nio.ByteBuffer.get(byte[], int, int)
http://java.sun.com/javase/6/docs/api/java/nio/ByteBuffer.html#get(byte[],%20int,%20int)
The documentation even hints "it is potentially much more efficient"
that retrieving each byte individually. Of course it is
/potentially/, just like the stream extraction function
std::basic_streambuf<C>::xsgetn(C*, streamsize) in C++:
http://www.dinkumware.com/manuals/?manual=compleat&page=streambu.html#basic_streambuf::xsgetn
However, in Sun's Java library, the ByteBuffer.get() method
mentioned first checks all the bounds and ensures sufficient
capacity and availability for extraction, then proceeds to repeat
these checks for each byte extracted.
Also, conside java.nio.ByteBuffer.get()
http://java.sun.com/javase/6/docs/api/java/nio/ByteBuffer.html#get(byte[])
Note that the documentation says that it behaves as if one called
the above get() method, passing 0 as the starting index, and the
array's length as the count. Now get this: that's exactly what the
implementation does, forcing the 0 and array length to be checked
suspiciously as though they were caller-provided arguments.
Again, the interfaces are sound, but the Quality of Implementation
is poor.
² http://common-lisp.net/project/cffi/
--
Steven E. Harris
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list