In a parallel project with almost all the UI coded in JS we use fully
qualified names in preference to nesting. I think it has evolved that
way partially as an attempt to make it easier for the casual reader
and newcomer to get in the code.  It certainly makes it easier to get
the context of a fragment of code, but it does increase typing and
potential errors.
Ian

On 26 July 2011 07:50, Paul Lindner <[email protected]> wrote:
> Hi,
>
> I'm curious to know what people think about some of the idioms in the JS
> code you find in shindig.  There's an awful lot of stuff like this:
>
> shindig.foo = function(){
>  //...
>  var myFunction = function() {
>     }
>
>  return {'foo': myFunction,
>            'bar': function() {
>               return 'bar';
>            }};
> }();
>
>
> Just search for @member to see the various places.
>
> What would people think if we moved to fully defined names for
> function/method definitions instead?
>
> You could still wrap this inside a closure if you wanted local scope:
>
> function() {
>  shindig.foo.foo = function() {
>     ...
>  }
>  shindig.foo.bar = function() {
>     ...
>  }
> }();
>
> --
> Paul Lindner -- [email protected] -- linkedin.com/in/plindner
>

Reply via email to