Trololololol ;p
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
3. I guess "helpful" is a matter of flavor and familiarity. i don't see the need to type down "classes" in js, may be thats the point.3.1 a helper in a sense of DRY have to reduce amount of code. now instead of typing down the prototype, constructor etc, you have to pass objects, that's just anouther side of the same verbosity and it changes the semantics here a bit ("i use classical mindset now").
3.2 your gist: to change the prototype of the Derived2 class you have to change lines47: call to "base" constructor51: call to getText from "base" proto, simulating super.getText57: Change property baseClassto change prototype at runtime you have to do even more, like replacing the getText property with a new function with the call to the new prototype. etc.
4. This is really a topic with potential to produce a next world war. there are so many definitions of OO and most of them are near by a dogma. OO is about Objects, objects encapsulate and hide internal data/state and offer public API to manipulate this data. Allan Key said in 2003:"OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme LateBinding of all things."No word of classes anymore. Classes are state of the art to define Types in OO, but its not the only way to do that. Inheritance is a preferred way to share and reuse Code in OO, but it's not the only way, "Favor Composition over Inheritance" is one of OO-Design Principles, because it's introduces looser coupling than the coupling offered by classical inheritance.
--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
Den måndagen den 5:e november 2012 kl. 10:01:58 UTC+1 skrev greelgorke:3. I guess "helpful" is a matter of flavor and familiarity. i don't see the need to type down "classes" in js, may be thats the point.3.1 a helper in a sense of DRY have to reduce amount of code. now instead of typing down the prototype, constructor etc, you have to pass objects, that's just anouther side of the same verbosity and it changes the semantics here a bit ("i use classical mindset now").It reduces the amount of code you must type down:
var Name = helper({
method1: function() {
},
method2: function() {
},
//..
});
vs
function Name() {
}
Name.prototype.method1 = function() {
};
Name.prototype.method2 = function() {
};
//...
Without the helper, you must repetitive times write: "Name.prototype". You can of course assign it in the function using this, but it is bad practice and has poor performance. And as soon you start to use any helper variable and function, do you use code you argue against.3.2 your gist: to change the prototype of the Derived2 class you have to change lines47: call to "base" constructor51: call to getText from "base" proto, simulating super.getText57: Change property baseClassto change prototype at runtime you have to do even more, like replacing the getText property with a new function with the call to the new prototype. etc.
http://killdream.github.com/blog/2011/10/understanding-javascript-oop/
--
"I like it more" is a fine reason to do it yourself. I think it's a waste of time but it's not my time.
Please for the love of science however don't encourage js newcomers to write their code like this.