Thanks for answer, everyone. It is decent of you to take time to answer me.

Raynos:

First of was you not allowed to use helpers, but because you did will i 
show you a shorter alternative:

var Name = myHelper({
  //...
});

Tada. No more typing and it does exactly the same thing as your example.


tjholowaychuk:

I know editors can remove must of those typing, but as soon as your brain 
sees it, will it
process it and therefore take energy. It is the inconvenient truth of all 
humans. The advertising industry uses it
all the time. Because of this, even if you a perfect editor those will fix 
everything for you will it always be preferable to
have less code, as long as the code does not add any complexity, as it does 
not if you ask me.

greelgorke:

Same answer applies to you as tjholowaychuk, so you can read what I wrote 
to her/him as well. Your proposal  "this.constructor.prototype.getText" 
does not work by the way,  so it should be graceful if you can show a 
minimal code example. And if it exist would it be OK to use it in the 
helper method as well, because it should be 100% compatible with pure 
JavaScript inheritance.

Alexey Petrushin:

You are using mixins, nothing wrong with it, sometimes is it preferred to 
actually inherit from another object/function to gain the "is-a" relation. 
With mixins can you only gain the relation "has-a". It is not the same 
thing as the relation "is-a". The "instanceof" operator will not work only 
because you add some methods to a prototype, as it must if it is a "is-a" 
relation. You can however emulate it pretty good do I believe with correct 
instanceof behaviour.


To all:

The largest disadvantages the helper class has it is uses the arguments 
parameter to forward all calls. It will prevent huge optimizations if V8 is 
not smart enough.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to