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.

6 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+

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 (17)
    • Open Source (14)
    • PHP (98)
    • Software Design (29)
    • Usability (14)
    • Web Design (20)
  • Recent Comments

    • Looking Towards the Cloud  23
      Betty Saletta, Driver License, Jamel Sawyer [...]
    • Benchmarking PHP's Magic Methods  12
      Article Marketing Strategy, Magento Development, Vance Lucas [...]
    • Improved Error Messages in PHP 5  32
      Terry Nessel, css, Amsterdam [...]
    • Keywords and Language Simplicity  11
      kim kardashian sex tape price, nokia, per Rechnung bestellen [...]
    • flickr case study  3
      bookmarking demon software, php-trivandrum.org, Harry Fuecks
    • rsync to remote server via ssh  7
      Burton Haynes, James, Mike [...]
    • Yahoo YUI wins JavaScript Library Wars  10
      Lera Bride, Scott, Jeff [...]
    • OOP is Mature, not Dead  15
      Avery Depew, Fernando, deltawing [...]
    • Ruby versus PHP or There and Back Again  10
      Solar Pumps, Amsterdam, Hari K T [...]
    • ZendCon: Writing Maintainable PHP Code  8
      IT Ninja, nicopico, Arif [...]
  • Recent Posts

    • 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
    • Working with PHP 5 in Mac OS X 10.5 (Leopard)
  • Site

    • Archives
    • Log in
  • Search