Best Practices for API Design
If your API is insufficient or non-existent then your application data and metadata will become part of your de-facto API. You don’t want that. . . really.
Here are some points to consider when designing an API or SDK:
- Get to know your users. Remember that you are an expert, but you are designing for non-experts. The goal is to make things easy for the user, not to impress them with how smart you are. Simple is king except when it violates the principle of least astonishment.
- Get to know your users. Write applications like those your users will create. What do you need from an API in order to implement these applications? Once your API is released, ask for copies of applications your users have created.
- Make common things easy and unusual things possible, but do not allow users to do evil things. Verify preconditions and inputs.
- Design for subclassing or prevent it.
- Accessor methods, not direct access to data, and Factories, not Constructors.
- Define, test, and measure usability.
- Get to know your users.
Some References:
-
API Design With Java (Formerly Interface Design: Best Practices in Object-Oriented API Design in Java)
http://www.artima.com/interfacedesign/contents.html
http://www.artima.com/apidesign/contents.html -
http://www.codeproject.com/gen/design/APIUsabilityArticle.asp
- Writing Solid Code – Candy Machine Interfaces
- What does God want from us?
- Want to learn CSharp and dotNET?