W3C home > Mailing lists > Public > public-webapi@w3.org > December 2006

Re: Selectors API naming

From: Nicolas Mendoza <mendoza@pvv.ntnu.no>
Date: Wed, 20 Dec 2006 19:52:39 +0100
To: "Charles McCathieNevile" <chaals@opera.com>, "Web API public" <public-webapi@w3.org>
Cc: "Chris Wilson" <Chris.Wilson@microsoft.com>, "Dave Massy" <dave.massy@microsoft.com>, "Anne van Kesteren" <annevk@opera.com>
Message-ID: <op.tkvf11xm4q17ch@agnus>

On Wed, 20 Dec 2006 19:13:08 +0100, Charles McCathieNevile  
<chaals@opera.com> wrote:

>
> On Tue, 19 Dec 2006 17:51:37 +0100, Charles McCathieNevile  
> <chaals@opera.com> wrote:
>
>> 1. Does anyone see any other issue in the current draft that should be  
>> fixed?
>
> I'm happy...
>
>> 2. For the following options, do you consider the names "fine", "not  
>> great but acceptable", or "unacceptable"?
>>       getElementBySelector/getElementsBySelector
>>       matchSingle/matchAll
>>       matchSingleBySelector/matchAllBySelectors
>
> (note the correction to the above :( Thanks Bjoern).
>
> Any of these is OK by me. I also like Berjon's "matchCSS" approach to  
> naming. Mostly, I still like names as short as possible, and shipping...
>
> cheers

Just butting in here, feel free to continue after my ramblings:

1. Being consistent is always good, even if it leads to long function  
names. There are limits of course. This favours "geElementBy#?".

2. The getElementBySelector seems to me as something that uses CSS  
selectors to get a subset of a DOM tree. Is this kind of selection  
supported in other places of DOM? Would it be clever to clearly note that  
the selection is done using CSS type of selector, or is the term  
"Selector" enough to show that this is different to any possible future  
ways of getting a subset of the tree? (This might favour  
"(match#?|select#?)CSS"

3. I guess the most correct name would by getElementsByCSSSelector, or  
even getElementBySelector("CSS",...)

4. I think keeping short names is only good in a short-term way (polluting  
your available namespace, making ambiguous symbols etc.) I don't think  
"letting developers type less" is a very good argument in favour. There  
are tools (auto-completion, auto-generating code) and preprocessors or  
languages supporting macros or function pointers/references if it's really  
necessary to type less.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Received on Wednesday, 20 December 2006 18:53:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:56 GMT