As an aside, I gave split as an example of a function with a poor interface.
It never occurred to me that anyone would attempt to defend it as a fine example of flawless API design -
just as I didn't expect anyone to defend (the awful) interface provided by ANSI C strtok function
when writing On Interfaces and APIs.
Though I'm able to use both split (in Perl) and strtok (in C), I sometimes roll on the floor
laughing at how bad their interfaces are. And yet their designers were very smart people ... which is
the second point I wanted to make, namely that good API design is a genuinely hard problem.
On Interfaces and APIs quotes Joshua Bloch's seven characteristics of a good API:
- Easy to learn.
- Easy to use, even without documentation.
- Hard to misuse.
- Easy to read and maintain code that uses it.
- Sufficiently powerful to satisfy requirements.
- Easy to extend.
- Appropriate to audience.
In your opinion, how does Perl's split
function measure up to the seven criteria above?
I said Guido "solved" the problem for Python by dumbing down split.
By putting the word "solved" in quotes, along with "dumbing down", I meant to indicate that it was not a particularly convincing "solution".