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:

  1. Easy to learn.
  2. Easy to use, even without documentation.
  3. Hard to misuse.
  4. Easy to read and maintain code that uses it.
  5. Sufficiently powerful to satisfy requirements.
  6. Easy to extend.
  7. 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".


In reply to Re^9: More comprehensive style guide for Perl docs than perlpodstyle? by eyepopslikeamosquito
in thread More comprehensive style guide for Perl docs than perlpodstyle? by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.