[erlang-questions] How to code against an interface rather than an implementation?

Richard A. O'Keefe <>
Mon Aug 12 06:57:11 CEST 2013


On 10/08/2013, at 3:34 AM, Garrett Smith wrote:
> Joe's response to this is quite comprehensive and I'll just echo it here.

I was thrilled to see Joe's response and to see it seconded.

The "generic interface" idea makes quite a lot of sense when
the things you want to interface to are essentially the same.
The major case of that is SQL data bases, where there is an
international standard (or are international standards) and
the various systems out there (Firebird, MariaDB, Postgresql)
are tolerably close, although it's astonishing how different
they can be (and not just in nonstandard features).

But that's a matter of papering over inessential details of
fundamentally similar things.  And then you end up with an
interface (ODBC or JDBC) that is harder to learn and drive
than the thing it interfaces to.

A similar example would be the POSIX "ndbm" interface, which
could be backed by original nbdm, by sdbm, by gdbm, or by BDB.
You end up imposing the limitations of the weakest/most
dangerous back end on the most powerful/safest.

One of the XP slogans is YAGNI: "You Ain't Gonna Need it".






More information about the erlang-questions mailing list