W3C home > Mailing lists > Public > public-device-apis@w3.org > November 2011

Re: Web API Design Cookbook

From: Dave Raggett <dsr@w3.org>
Date: Thu, 10 Nov 2011 16:39:32 +0000
Message-ID: <4EBBFE44.8090004@w3.org>
To: Robin Berjon <robin@berjon.com>
CC: "public-device-apis@w3.org" <public-device-apis@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:24 GMT