Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22514

Re: Composer.js released for simple object composition

Newsgroups comp.lang.javascript
Date 2014-01-01 19:32 -0800
References <f65ec491-6139-474a-97b8-f6b5882db680@googlegroups.com> <ac4bebc8-9e5e-4973-8fd7-9e5dec4eb0c0@googlegroups.com>
Message-ID <ffd2d9ae-b147-41fa-84ff-637ab45b2612@googlegroups.com> (permalink)
Subject Re: Composer.js released for simple object composition
From "Michael Haufe (TNO)" <tno@thenewobjective.com>

Show all headers | View raw


On Sunday, December 29, 2013 4:46:55 PM UTC-6, Michael Haufe (TNO) wrote:
> On Friday, December 27, 2013 11:34:46 AM UTC-6, Joshua Tenner wrote:
> 
> > http://jtenner.github.io/Composer.js/
> >
> > Check it out!
> > 
> > Thanks.
> 
> Do you have any practical examples? My feel is that this is overcomplicated, but I'd like to see a side by side comparison with other solutions for a better evaluation.

After spending a little more time looking at this, I'm disappointed and confused. The author doesn't seem to understand the language well enough and the documentation is hard to follow. There seem to be at least three ways to create the objects. Sometimes "mixins" are used and sometimes prototypical inheritance with explanation to why.

There is also a somewhat inaccurate/incomplete claim made about IE8 regarding getters/setters. The author then claims that his library resolves this issue by relying on ES5 features (In three different ways of course).

There exist some forms of "factory" composition/collapsing (mixins?), but how this works is not clear especially if the components are a sequence of objects and constructors.

There is a fluent interface, but I'm not certain if these are static methods or not (or both).

The final section of the documentation is what scares me away from looking at this library any deeper:

> Composer was designed with portability in mind.
> Check out the following example.

> var store = Composer().phrase(function(values){
>   var key, myStore = {};
>   for(key in values){
>     set(key, values[key]);
>   }
>   function get(myKey){
>     return myStore[myKey];
>   }
>   function set(myKey, val){
>      myStore[myKey] = val;
>      return this;
>   }
>   this.set = set;
>   this.get = get;
> });

> Now just use your factory.

> var myStore = store({
>   "foo": "bar",
>   "baz": "nee"
> });

> myStore.get("foo");
> //"bar"

> myStore.get("baz");
> //"nee"

> myStore.set("baz","blah").get("baz");
> //"blah"

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Composer.js released for simple object composition Joshua Tenner <tenner.joshua@gmail.com> - 2013-12-27 09:34 -0800
  Re: Composer.js released for simple object composition "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-12-29 14:46 -0800
    Re: Composer.js released for simple object composition "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-01-01 19:32 -0800

csiph-web