What makes an API great?

After few years of Java programming, I improved slower than I expected but still... When designing complex software which needs to be reused, I still find it difficult to make quick and "good" choices without adding too much complexity.

In the last branch of XPontus XML Editor(major refractoring), I had a dilemma:

  • Release soon : couple of patches and dirty classes which do the job
  • Wait 4 or 5 months to be ready : clean up the code, perform thorough testing, remove unused classes, add or redesign interfaces, etc.
I choose to release early and fix what I could see or had time to fix. One month after the release, I was like "why did I do it that way? what is that useless piece of code doing over here, etc."

IMHO, an API is great when it's
  • simple
  • useful
  • flexible(without adding too much complexity when it's unnecessary).

I tend to prefer APIs which expose few interfaces, abstract classes and some concrete classes. Complex applications APIs without/with few interfaces, are somehow difficult to maintain, refractor, make evolve.

Bookmark the permalink. RSS feed for this post.

One Response to What makes an API great?

delvinj said...

jEdit has an awesome api. It's all the things you mention, but it's easy to get up to speed with and easy to come back to and hack on. If you're a java programmer you will probably enjoy hacking the beanshell interface.

It's been 2 years or so since I last saw any jEdit code, and I really miss hacking on it.

How does one script xpontus?

Daniel

Swedish Greys - a WordPress theme from Nordic Themepark. Converted by LiteThemes.com.