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


Groups > comp.lang.javascript > #18652 > unrolled thread

[ANN] Barman - Small library to define objects using single-inheritance and traits

Started byDiego Fernandez <diegof79@gmail.com>
First post2013-02-27 08:57 -0800
Last post2013-03-01 00:11 +0100
Articles 5 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  [ANN] Barman - Small library to define objects using single-inheritance and traits Diego Fernandez <diegof79@gmail.com> - 2013-02-27 08:57 -0800
    Re: [ANN] Barman - Small library to define objects using single-inheritance and traits Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-27 19:39 +0100
      Re: [ANN] Barman - Small library to define objects using single-inheritance and traits Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-28 14:14 +0100
        Re: [ANN] Barman - Small library to define objects using single-inheritance and traits Andrew Poulos <ap_prog@hotmail.com> - 2013-03-01 09:53 +1100
          Re: [ANN] Barman - Small library to define objects using single-inheritance and traits Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-01 00:11 +0100

#18652 — [ANN] Barman - Small library to define objects using single-inheritance and traits

FromDiego Fernandez <diegof79@gmail.com>
Date2013-02-27 08:57 -0800
Subject[ANN] Barman - Small library to define objects using single-inheritance and traits
Message-ID<f72e2592-8b9f-472e-b092-ccffcb9437f2@googlegroups.com>
Hi group, the subject says it all. I wanted to annonce the first public version of barman:

Source:
https://github.com/dfernandez79/barman

NPM:
npm install barman

There are a lot of similar JavaScript libraries, to name a few: composejs, dejavu, classy. 

Barman has similarities and differences, so its another option to take into account for your tool set.

I hope that you find it useful. Your feedback is welcome!

Thanks!
Diego.-

[toc] | [next] | [standalone]


#18653

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-02-27 19:39 +0100
Message-ID<5545405.CXyfL3cyKS@PointedEars.de>
In reply to#18652
Diego Fernandez wrote:

> There are a lot of similar JavaScript libraries, to name a few: composejs,
> dejavu, classy.

If all of them are as bad as yours then I am not surprised that I have not 
heard of any of them ;-)

> Barman has similarities and differences, so its another option to take
> into account for your tool set.
> 
> I hope that you find it useful. Your feedback is welcome!

BTDT (in JSX:object.js [1]), so I doubt your code would be of value to me.

The following issues in your code are indicative of overall bad code to me 
at a glance:

- You are adding a “__super__” property to an object with non-empty
  prototype chain.  Those property names are reserved for
  implementation-specific behavior;

- You are using a lot of unnecessary wrappers (isUndefined, isFunction, …);

- extend() for-in iterates over inherited properties;

- isObject() does type conversion;

- You are using the word “class” inappropriately several times.  These are
  languages using prototype-based inheritance;

- You are augmenting the host object referred to by “window” when you should
  have augmented the ECMAScript global object as referred to by “this” in
  the global execution context (think “parameters”).

Other than that you do have a sense for good code style, though, which is 
rare in this field, and a plus.

Since you are supporting ECMAScript Ed. 5.x as well (“'use strict'”), you 
should leverage the built-in features that are new in that Edition through 
feature-testing and proper emulation as fallback.  Or you might want to 
provide an ES-5.x-only version.  For either of that, you might want to 
bookmark <http://PointedEars.de/es-matrix> or have a look at

[1] 
<http://PointedEars.de/websvn/filedetails.php?repname=JSX&path=%2Ftrunk%2Fobject.js>.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#18661

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-02-28 14:14 +0100
Message-ID<1692420.Ia5zpk6XBy@PointedEars.de>
In reply to#18653
Thomas 'PointedEars' Lahn wrote:

> - extend() for-in iterates over inherited properties;

You might want to ignore that.  I have reviewed Function.prototype.extend() 
in the current JSX:object.js [1] and I have done the same there (my code is 
Function-specific, though).  As I recall, the rationale for that was that 
Object instances would be used as extension source; if anyone augmented 
Object.prototype they deserved what they get, and jumping through hoops to 
work around it was too much to ask me for.

What do you think?
 
> [1]
> 
<http://PointedEars.de/websvn/filedetails.php?repname=JSX&path=%2Ftrunk%2Fobject.js>.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#18670

FromAndrew Poulos <ap_prog@hotmail.com>
Date2013-03-01 09:53 +1100
Message-ID<wYudnZuEYuNBQrLMnZ2dnUVZ_rOdnZ2d@westnet.com.au>
In reply to#18661
On 1/03/2013 12:14 AM, Thomas 'PointedEars' Lahn wrote:

>> [1]
>>
> <http://PointedEars.de/websvn/filedetails.php?repname=JSX&path=%2Ftrunk%2Fobject.js>.
>
Its copyright notice says "2004-2012". Should it be "2004-2013"?

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#18671

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-03-01 00:11 +0100
Message-ID<2864330.OleRHuZomt@PointedEars.de>
In reply to#18670
Andrew Poulos wrote:

> On 1/03/2013 12:14 AM, Thomas 'PointedEars' Lahn wrote:
>>> [1]
>>>
>> 
<http://PointedEars.de/websvn/filedetails.php?repname=JSX&path=%2Ftrunk%2Fobject.js>.
>>
> Its copyright notice says "2004-2012". Should it be "2004-2013"?

Yes, as per the changelog.  That will be fixed in the next revision; thanks.  
I would rather update the year automatically, but apparently there is no SVN 
keyword for that.  I can set and use only:

- $LastChangedDate$
- $LastChangedRevision$
- $LastChangedBy$
- $HeadURL$
- $Id$

And if I do, I end up with a rather ugly “$Keyword: …$”.  However, AIUI the 
Copyright line is required for GPL-licensed works.  Constructive suggestions 
are welcome.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web