Re: Web API Design Cookbook

On 10/11/11 15:05, Robin Berjon wrote:
> Hi all,
>
> several people (notably Bryan) have been asking for a repository of common practices in designing Web APIs. This has also been discussed in WebApps and the Script Library CG.
>
> I've taken a few ideas I heard, fleshed out one of the sections as an example, and put it up at:
>
>      http://scriptlib-cg.github.com/api-design-cookbook/
>
> The source is on GitHub (it will also be synced to the W3C server):
>
>      https://github.com/scriptlib-cg/api-design-cookbook
>
> Everyone is welcome to contribute (either recipes or empty sections calling out the need for one). The way to do this is through the usual GitHub development process: fork, modify, and make a pull request to the editor.
>
> Editing is handled from an organisation account, and I'm happy to add people to the organisation.

One pattern we could add would be on the role of local synchronous 
properties that proxy remote properties, e.g.

       sensor.temperature

where sensor has been previously bound to a local object proxying a 
remote sensor.  The implementation of the proxy object hides the details 
of how changes are propagated from the remote service the object proxies.

This can be considered as a poor man's version of promises where the 
proxied property is undefined until it has been set by the object's 
implementation. This design pattern works nicely where there isn't a 
need for strict synchronization and you don't want web page scripts to 
deal with the underlying communication protocol, or to deal with the 
conceptual challenges of full blown promises including pipelining.


-- 
  Dave Raggett<dsr@w3.org>  http://www.w3.org/People/Raggett

Received on Thursday, 10 November 2011 16:40:00 UTC