I still prefer status quo, as it reads more like a proper class to me, while
being less verbose and centralizing the exported method definitions in a
single place.

As well, this question's corollary is whether to convert all instantiable
objects to the form:

FooClass.prototype.method = function() { }
FooClass.prototype.method2 = function() { }

...from:
FooClass = function() {
  // private state
  function method() { }
  function method2() { }
  return {
    method: method,
    method2: method2
  };
};

On this note, I'm conflicted. I like having actual private state, but
prototype-style is more efficient.

Enough people have complained over time about each of the existing idioms
though that I suppose I could go the other direction, if it's causing
development trouble.

--j

On Tue, Jul 26, 2011 at 6:17 AM, Ryan J Baxter <rjbax...@us.ibm.com> wrote:

> +1 As well, I think its easier to read.
>
> -Ryan
>
> Email: rjbax...@us.ibm.com
> Phone: 978-899-3041
> developerWorks Profile
>
>
>
> From:   Dan Dumont/Westford/IBM@Lotus
> To:     dev@shindig.apache.org,
> Date:   07/26/2011 09:00 AM
> Subject:        Re: javascript readability..
>
>
>
> +1
>
>
>
> From:   Paul Lindner <lind...@inuus.com>
> To:     dev@shindig.apache.org,
> Date:   07/26/2011 02:51 AM
> Subject:        javascript readability..
>
>
>
> 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 -- lind...@inuus.com -- linkedin.com/in/plindner
>
>
>
>
>
>
>

Reply via email to