1.5 Make it Modular
April 15th, 2009 — Marieke GuyIt is better to create an API that has one function and does it well rather than an API that does many things. Good programming is inherently modular. This allows for easier reuse and sustains a better infrastructure.
“Another problem is that methods sometimes aren’t quite configurable enough. Sometimes there is a simple method which will do the job nine times out of ten and then a similar but more advanced, more difficult to use method which offers extra functionality — this is a good solution to the problem.“
The service should define itself and all methods available. This means as you add new features to the API, client libraries can automatically provide interfaces to those methods without needing new code.
“It is not enough to put a thin layer on top of a database and provide a way to get data from each table separately. Many common pieces of information can only be retrieved in a useful way by relating data between tables. A decent API would seek to make retrieving commonly-related sets of data easy.“
April 24th, 2009 at 9:41 am
[...] 1.5 Make it Modular [...]