Mike Williams <[EMAIL PROTECTED]> wrote on 01/07/2005 09:03:49 PM:
> I have little idea of what best practice is in the _javascript_ world, but
> I wonder if we could clean up the core _javascript_ code a little, perhaps
> even introduce some coding standards, etc.
>
> I've been perusing "Prototype" - a _javascript_ library that supports much
> AJAX goodness, and really like what I see:
>
> * Use of top-level objects (often empty) as namespaces
> * A Class.create() function that makes class declarations seem more
> natural
> * A Ruby-like "extend" function for mixins
>
> See http://prototype.conio.net/dist/prototype-1.2.0.js ... I'm not
> suggesting we integrate it, just wondering if people like the
> coding-style used.
It would be nice to have a coding standard (possibly documented on the Selenium Confluence site?), and we could do worse than one based on Prototype. Are you also suggesting that we copy their code for Class.create() and Object.extend() ?
>
> What do you think of introducing a top-level "Selenium" namespace, and
> pushing BrowserBot etc underneath it? It might mean pushing the
> existing "Selenium" object down a level, though - "Selenium.API"?
>
+1
> Can we agree on no TABs in code/tests, or is that contentious?
I definitely prefer spaces to tabs.
>
> Also, I was chatting offline with David Kemp and Daz Deboer about the
> possibility of reducing the number of Selenium _javascript_ files ... at
> least for distribution, if not for source-control. I suggested a
> "selenium-fitrunner.js", with "selenium-core.js" containing everything
> else, which would make deployment easier. We could even version-control
> it as separate files, and combine it in a build step. I don't think I
> convinced anyone :-(
From the developer's viewpoint, I think several small files is better than two large files, but we might need some guidelines (e.g. should we try to avoid cyclic dependencies between the files?).
Would combining them in a build step really help users? After all, Selenium is not intended to be a library that others can include in their own applications (or are there people out there doing exactly that?)
While on the topic of the source file structure, htmlutils.js should either be renamed selenium-utils.js (as it contains non-html stuff in it), or should have the non-html stuff shifted out of it (but still be renamed to something like selenium-htmlutils.js). I actually prefer breaking the file up. If you look at the structure for "Prototype" (http://dev.conio.net/repos/prototype/src) you will see that they have a "string.js" where they have extended String and I think we should do something similar.
I will wait a few days to give time for people to object before I start splitting and renaming files :-)
David Kemp
ThoughtWorks Australia Pty Ltd
http://www.thoughtworks.com
_______________________________________________ Selenium-devel mailing list Selenium-devel@lists.public.thoughtworks.org http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel