1
vote
1answer
66 views

Is doing Parent.call from the child object a right way to implement Inheritance in JavaScript?

I came across this piece of code it didnt look that right to me. Is it the right way to implement SUPER in javascript. if not what is the right way? function Person(name){ this.name = name; } ...
2
votes
0answers
98 views

JavaScript Combination Inheritance Pattern

In the chapter of Professional JavaScript for Web Developers on OOP, Nicholas Zachas describes a JavaScript inheritance pattern which he refers to as combination inheritance. The basic idea is that ...
1
vote
0answers
166 views

Reusable and customizable charting library on top of d3js

I have started building a charting library on top of d3js using javascript's inheritance. My goal is to develop reusable and fully customizable chart components. I read the article: Towards Reusable ...
-1
votes
1answer
62 views

Concerning JavaScript prototype and the initial constructor function

I am going through a tutorial on OOP in JavaScript (javascriptissexy.com using OOP in JS: What you Need to know). The instructor is explaining the Constructor/Prototype pattern of object creation. I ...
3
votes
3answers
173 views

Which one subsumes the other: class-based object-orientation or prototypal inheritance?

In this talk: http://www.youtube.com/watch?v=hQVTIJBZook, Douglas Crockford claims that class-based object-orientation can be represented in terms of prototypal inheritance. The construction he gives ...
8
votes
2answers
410 views

Why is the use of constructors discouraged when creating prototypes?

Quick background: In JavaScript, the constructor function for each object type has a prototype property. The prototype refers to an object that each constructed object uses as the next step up in its ...
8
votes
1answer
915 views

JavaScript objects and Crockford's The Good Parts

I've been thinking quite a bit about how to do OOP in JS, especially when it comes to encapsulation and inheritance, recently. According to Crockford, classical is harmful because of new(), and both ...
2
votes
3answers
2k views

Are super methods in JavaScript limited to functional inheritance, as per Crockford's book?

In Douglas Crockford's "JavaScript: The Good Parts", he walks through three types of inheritance: classical, prototypal, and functional. In the part on functional inheritance he writes: "The ...
14
votes
4answers
3k views

Inheritance vs mixins in dynamic languages?

When should you prefer inheritance patterns over mixins in dynamic languages? By mixins, I mean actual proper mixing in, as in inserting functions and data members into an object in runtime. When ...