Re:Node.js library for the Amazon Web Services
by jfarmer on Thursday January 19, 2012 @03:37PM
(#3486564)
I would rather have something verbose that corresponds to the underlying API than something I have to guess or remember.
Is it createProdAdvClient, createProductAdvClient, createProdAdvertisingClient, createProdAdvertClient, etc.?
Completely arbitrary.
My ideal API clients have a base layer that maps intuitively to the underlying API, and a developer-friendly upper layer with idiomatic method calls.
A common trick in Ruby, for example, is to give the API client a proxy method (e.g., api) that uses method_missing to map method calls to API end points.
You wind up with API clients that look like client.api.some_method(...). Under the hood it might transform some_method into "someMethod" before it makes the API call.
However, if you want, you can still access the raw API endpoints programmatically.
Just my preference, I realize, but I think it's important for libraries to idiomatic.
Is it createProdAdvClient, createProductAdvClient, createProdAdvertisingClient, createProdAdvertClient, etc.?
Completely arbitrary.
My ideal API clients have a base layer that maps intuitively to the underlying API, and a developer-friendly upper layer with idiomatic method calls.
A common trick in Ruby, for example, is to give the API client a proxy method (e.g., api) that uses method_missing to map method calls to API end points.
You wind up with API clients that look like client.api.some_method(...). Under the hood it might transform some_method into "someMethod" before it makes the API call.
However, if you want, you can still access the raw API endpoints programmatically.
Just my preference, I realize, but I think it's important for libraries to idiomatic.