Professional PHP

PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.
« Sometimes Plain Text is Best
Hazards of primarily using a cell phone »

API Design

May 5th, 2004

I ran across a couple older items on API design: Words of Wisdom on Designing Usable APIs and Think of Objects as Machines.

good API designs happens when designers think of … client programmers as users.

I wish more developers took this to heart. I’ll add my own law of API design:

Good API design makes common things simple while leaving uncommon things possible.

You can call it Moore’s law. :)

When comparing two API possibilities, I often just count characters in a couple common examples of usage. To me, the API choice that results in fewer characters for the client programmer is usually the better API. This can tip the balance for subtle choices, or help evaluate two libraries which do the same thing.

Filed Under

  • Software Design

Related Posts

  • Design Eye for the Usability Guy
  • php | tek Wrapup
  • Michigan Taxes Graphic Design Services
  • The rumors of PEAR’s demise are greatly exaggerated
  • PDO Design Evolution
You can leave a response, or trackback from your own site.

7 Responses to “API Design”

  1. Marcus Baker says:
    5/10/2004 at 6:22 am

    Hi.

    As an experiment the early versions of the SimpleTest API used TDD – Tutorial Driven Design. I wanted to write a mock object article and so wanted to add mocks to PHPUnit. I was working out the interface through the article. The problems I encountered caused me to write my own test case class and shelve the article for nearly a year.

    Recently the API has been driven more by user requests, theft from the Java world (JWebUnit) and domain concepts (the web browser), but I am thinking that more than anything I should write another tutorial.

    yours, Marcus

  2. Harry Fuecks says:
    5/10/2004 at 4:11 pm

    Tutorial Driven Design – you may be onto something. Seriously. Course it’s going to be hard for managers to swallow: “All coding begins… with a tutorial”

  3. Jeff Moore says:
    5/12/2004 at 6:51 pm

    Maybe thats why I like SimpleTest so much. Designing the application by writing user documentation is not a new idea. I think that taking a tutorial oriented approach is a great idea because it focuses on the tasks that a user would want to do. User documentation that simply enumerated screens and menu items or that simply enumerated classes would not be good candidates for driving development. They are too much like the big design up front that the agile methodologies are trying to avoid. Writing tutorials doesn’t sound much different than writing stories. (use cases, essential use cases, scenarios or whatever you want to call them, I have a fondness for task based UI design.)

  4. Jeff Moore’s Blog » Exceptional PHP says:
    5/24/2004 at 9:38 pm

    [...] was 15% less code (he was comparing compiled code size) and maybe 5% faster. Following my API Design principles, I think the smallest amount of c [...]

  5. Mel Pullen says:
    10/11/2004 at 12:39 am

    design by documentation is not new. The Sperry Univac 1100 mainframe operating system was not written until the reference manual had been written and approved.
    It’s still a great idea. Anyone want to collaborate on a book?

  6. Katie says:
    11/6/2006 at 12:51 am

    Looking+for+information+

  7. Alvin Bah says:
    1/10/2012 at 5:11 am

    Great post! I never thought I would like ebooks but I’m converted. I have a ton and love writing them as well.

Leave a Reply

Click here to cancel reply.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

code: use [code=php][/code].

Comment Preview

    Subscribe Feed
    Share Subscribe to this blog…
    Share Bookmark or share this page…
  • About

    My name is Jeff Moore. I'm a PHP programmer living in San Francico and working for a startup.

    More about me…

  • Categories (Home)

    • Agile Methods (14)
    • Mac (14)
    • Misc (18)
    • Open Source (14)
    • PHP (99)
    • Software Design (29)
    • Usability (14)
    • Web Design (20)
  • Recent Comments

    • Working with PHP 5 in Mac OS X 10.5 (Leopard)  258
      Tuan Lal, Lavagem de estofados, Edward L. Kind [...]
    • php | tek 2008  36
      how to mend ice machine, Akademija Debelih, Odbacena [...]
    • goto in PHP  59
      kasor, Thomas Valdivieso, Murray Ziadie [...]
    • Firefox Extensions for Web Developers  33
      kasor, Website Design Toronto, mobila bistrita [...]
    • Why PHP is easier to learn than Java  68
      kasor, Justina Calvery, Guy Lipton [...]
    • Meta Tag Refresh Faux Paux  43
      html email templates, E-Juice Reviews, image [...]
    • Improved Error Messages in PHP 5  49
      Carroll Tina, Przeprowadzka, Emery Harari [...]
    • Benchmarking PHP's Magic Methods  33
      kayu oyunlar?,dora,oyun,oyna, Benjamin Bejjani, paypal website [...]
    • Microbenchmarks of single and double qouting.  24
      kefir grains minneapolis, sexshop dildo, tuim688 [...]
    • PEAR Templates  17
      Kandice Sansing, car insurance estimates for teenagers, Dale Brence [...]
  • Recent Posts

    • Richard Thomas
    • ZendCon: Writing Maintainable PHP Code
    • Looking Towards the Cloud
    • Holiday Tech Support
    • Closures are coming to PHP
    • php | tek Wrapup
    • php | tek 2008
    • Sarah Snow Stever
    • Benchmarking PHP’s Magic Methods
    • The Endpoints of the Scale of Stupidity on Video
  • Site

    • Archives
    • Log in
  • Search