Summary: prototypes as classes (PaCs)

Axel Rauschmayer axel at
Tue Jun 28 16:43:09 PDT 2011

>> Explaining constructors-as-classes is really hard, explaining subclassing is even harder.
> This really depends on the student's background and previous experience. It is not universally true.

True, but it’s the experience I’ve had so far (explaining JS to friends). And there were no Selfers (I wouldn’t even consider myself one).

Do students who prefer constructors really understand and use prototypes properly?

What I usually see is something like this:

function C(x, y) {
    return {
        x: x,
        y: y,
        doSomething: function() { ... }

That is indeed easier to understand than PaCs. It only becomes complicated when you move shared data into the prototype. And when you subclass.

There might be enough other obstacles to prevent PaCs from happening, but: Is there a way to test whether constructors or PaCs are easier to understand for newbies? For example: Give a few JS newcomers a description of both PaCs and constructors and let them rate both proposals with regard to ease of understanding?

What would be the question to ask, e.g. after someone has read my blog post? “Which do you find easier to understand – constructors or prototypes-as-classes?”
Problem: Finding descriptions that don’t have bias.

At any rate, I really want to see Allen’s proposal (once it is finished).

Dr. Axel Rauschmayer

axel at


More information about the es-discuss mailing list