Re: APIs that overload numbers and strings

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