W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: APIs that overload numbers and strings

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Mon, 15 Apr 2013 08:16:14 -0700
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>, Ehsan Akhgari <ehsan.akhgari@gmail.com>
Message-Id: <E822E110-17ED-4812-A086-DBC73CC44548@wirfs-brock.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>

On Apr 15, 2013, at 7:56 AM, Boris Zbarsky wrote:

> On 4/14/13 6:18 PM, Allen Wirfs-Brock wrote:
> 

...
>> this is probably where I would fall back to recommending that all API specs include a demonstration implementation of its functions written in JS (at least of the parameter processing, it is probably ok for the semantic guts to be a stub).  If it is hard or complex in JS then it probably isn't a very good API design
> 
> That's an interesting thought.
> 
> Though note that jQuery, say, does some nontrivial argument processing that while not "hard" is not exactly intuitive...  For example the|options = jQuery.extend( {}, options );| pattern.

In some cases there may be a reasonable usability justification for some complex in parameter handling. See, for example the I18N APIs I mentioned.  Having to express that in JS would require designers to more directly front that complexity and perhaps help them better evaluate whether it is actually justified.

Allen
Received on Monday, 15 April 2013 15:16:44 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC