W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

Re: [IndexedDB] Changing the default overwrite behavior of Put

From: Kris Zyp <kris@sitepen.com>
Date: Thu, 17 Jun 2010 11:26:25 -0600
Message-ID: <4C1A5AC1.7010300@sitepen.com>
To: Jeremy Orlow <jorlow@chromium.org>
CC: Jonas Sicking <jonas@sicking.cc>, Nikunj Mehta <nikunj@o-micron.com>, Shawn Wilsher <sdwilsh@mozilla.com>, public-webapps WG <public-webapps@w3.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 


On 6/17/2010 10:24 AM, Jeremy Orlow wrote:
>
> On Wed, Jun 16, 2010 at 9:58 AM, Shawn Wilsher <sdwilsh@mozilla.com
> <mailto:sdwilsh@mozilla.com>> wrote:
>
>         So, in summary, I agree to splitting the put method in to
>         two - put and putNoOverwrite. I am also in favor of
>         retaining the name as put (contrasted with get). I would
>         like to avoid bikeshedding on names even though there have
>         been ample opportunities on this list lately with that.
>
>     I think you are completely ignoring the arguments in this thread
>     about the issues with naming it put.  I don't think it is
>     bikeshedding; these seem like legitimate concerns.
>
>
> Agreed.  We need to at least discuss whether aligning with REST is
> important.  I don't care much either way, but you should at least
> give Kris a chance to respond.
>
> Also, if there are only 2 states (overwrite and noOverwrite) then a
> parameter to put (rather than 2 functions) might still be the best
> approach.

My order of preference:
1. parameter-based:
put(record, {id: "some-id", overwrite: false, ... other parameters ..});
This leaves room for future parameters without a long positional
optional parameter list, which becomes terribly confusing and
difficult to read. In Dojo we generally try to avoid more than 2 or 3
positional parameters at most before going to named parameters, we
also avoid negatives as much as possible as they generally introduce
confusion (like noOverwrite).
2. Two methods called "put" and "create" (i.e. put(record, id) or
create(record, id))
3. Two methods called "put" and "add".

Is putNoOverwrite seriously a suggestion? That's sounds like a
terrible name to me.

- -- 
Kris Zyp
SitePen
(503) 806-1841
http://sitepen.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iEYEARECAAYFAkwaWsEACgkQ9VpNnHc4zAxxmQCfSVxfyo6OiutdKdYRcRFKz5DD
7QYAnjxuUgHkuMbeLjPYCWYvi2iDCWio
=b/if
-----END PGP SIGNATURE-----
Received on Thursday, 17 June 2010 17:28:24 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:39 GMT