API, Framework, and Library Design

Over the past 6 months I’ve spent a good chunk of my time reading about frameworks, libraries and APIs. My new job has me writing Java against our API, which is a interesting switch from writing C#. Now I’m digging into Java and it’s myriad of libraries so I have an opportunity to really compare and contrast APIs and Frameworks. I’ve seen 5-10 blog posts, articles, etc. over the past couple of weeks about API design; so I figured I should join the masses and blog about it too.

Framework Design Guidelines

I saw Brad Abrams give a talk titled, “Framework Design Guidelines: The Art of Building a Reusable Class Library” at Seattle Code Camp v1.0 . The talk was great and I had to pick up his book, Framework Design Guidelines. The book is not a reference, it is a journey through the what and why behind the each of the recommended guidelines. Read it, even if you’re not into .NET, it’s worth it.

How to Design Good APIs and Why It Matters a presentation by Joshua Bloch

I would love to see this presentation live. The bullet points give you 20,000 foot view and give you some interesting things to consider. Here are some that caught my eye:

  • Public classes should not subclass other public classes for ease of implementation.
  • Avoid Overloading… Just because you can doesn’t mean you should.

Library or Framework?

Guido van Rossum had a an interesting post that seems to describe a libary as Joshua Blocks described an API in his presentation.

But a good library requires much more — there, you need to start with requirements, abstractions and attempt at a minimal API that addresses the maximal set of requirements. Frameworks have no requirement to be minimal in size while maximal in features.

Leave a Reply