This was my initial reaction when introduced to prototypal inheritance. I was like, jeez, do you have to make it so awkward to instantiate objects? Why can’t you just be like everyone else.
I feel vaguely guilty now, a little like that teacher who called young Einstein dumb. Turns out prototypal inheritance is awesome. Cue Highschool Musical and other stories of upsetting the status-quo.
What is Prototypal Inheritance?
In a word it’s delegation — not inheritance at all.
Well, if you are using classes… then you are.
Classes vs Prototypes
In class based inheritance everything is a clone (think Star Wars). Each clone shares the same behaviors (methods) as Boba Fett. They look like Boba Fett, talk like Boba Fett, and shoot like Boba Fett.
Anyway, the advantage of this tyranny (who knew there were advantages to tyranny?) is that your code is DRY. Think about the case when you have a 1,000 or a 1,000,000 instances — do you really want to duplicate shared behavior? Since we are all obsessive about computational efficiency the answer is no.