W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010


From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 24 Sep 2010 20:08:03 -0700
Message-ID: <AANLkTinDnWpOA9JE2TqtNQajHZUg_sruvOaHtN+GVjAm@mail.gmail.com>
To: Devdatta Akhawe <dev.akhawe@gmail.com>
Cc: Adam Barth <w3c@adambarth.com>, Ojan Vafai <ojan@chromium.org>, Darin Fisher <darin@chromium.org>, Garrett Smith <dhtmlkitchen@gmail.com>, Julian Reschke <julian.reschke@gmx.de>, WebApps WG <public-webapps@w3.org>
On Wed, Sep 22, 2010 at 12:54 AM, Devdatta Akhawe <dev.akhawe@gmail.com> wrote:
>> 2) I've added two flavors of appendParameter.  The first flavor takes
>> a DOMString for a value and appends a single parameter.  The second
>> flavor takes an array of DOMStrings and appends one parameter for each
>> array.  This seemed better than using a variable number of arguments.
> -1
> I really want the setParameter method - appendParameter now requires
> the developer to know what someone might have done in the past with
> the URL object. this can be a cause of trouble as the web application
> might do something that the developer doesn't expect , so I
> specifically want the developer to opt-in to using appendParameters.

If you really don't want to care what happened before, either do a
clearParameter every time first, or define your own setParameter that
just clears then appends.  Append/clear is a cleaner API design in
general imo, precisely because you don't have to worry about colliding
with previous activity by default.  A set/clear pair means that you
have to explicitly check for existing data and handle it in a way that
isn't completely trivial.

> I know clearParameter is a method - but this is not the clear
> separation between the '2 APIs' that we talked about earlier in the
> thread.
> I remember reading about how some web application frameworks combine
> ?q=a&q=b to q=ab at the server side, whereas some will only consider
> q=a and some will only consider q=b. This is such a mess - the
> developer should have to specifically opt-in to this.

It's a mess for server-side languages/frameworks, yes.  Some of them
handle this incorrectly.  Most of the current crop of popular ones,
though, do things properly with one method that retrieves the last
value and one that retrieves all values (PHP is marginal in this
respect with its magic naming convention).

Attempting to relegate same-name params to second-tier status isn't a
good idea.  It's very useful for far more than the "old services that
are also accessed via basic HTML forms" that you stated earlier.

Received on Saturday, 25 September 2010 03:38:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:11 UTC