Transcript from the "Classical vs Prototypal Inheritance" Lesson
>> Kyle Simpson: Let's try to clarify some ideas around inheritance, okay? Because there is a lot of things that I've thrown at you and I just wanna make as clear sort of a visual diagram as I can. In classical oriented Languages C++, Java, stuff like that. When you make a class call workshop and you instantiate it, you are conceptually and in some cases, physically copying down into those instances.
[00:00:28] And when you make a child class call another workshop that extends workshop, you are copying down into that. And when you instantiate that child class. You're doing more copies. So in other words these arrows are going from left to right, top to bottom, because they are fundamentally copy operations.
[00:00:47] When you try to do prototypal inheritance, you have a workshop.prototype object. And then you make another object like deepJS or reactJS, those objects are linked to Workshop.prototype. And then when you make another workshop.prototype it is linked to. And then when you make JSRecentParts it is linked too. So here, the arrows go from right to left, and bottom to top.
[00:01:16] Because this is a linkage, not a copy. Follow me.
>> Kyle Simpson: This is often to referred to as prototypal inheritance.
>> Kyle Simpson: I have a deep, troubling issue with the idea of calling this prototypal inheritance. And here is what my issue is. The word prototypal doesn't even really mean anything concrete to must people.
[00:01:46] Nobody even really knows what that means. They just associate it with this strange system. But the word inheritance has a very strong meaning, it carries lots of baggage. And most people's brains have been programmed to think about inheritance, as having copy relationships. So what we did was we took this confusing-sounding fancy word like prototypal, stuck it in front of another word.
[00:02:09] And then we pretended as if that's okay, to completely reverse the meaning of it. It's as if I stood up in front of you and I had an apple in one hand, and an orange in the other. And then I said, no, no, no that's not an apple.
[00:02:23] That's just a red orange.
[00:02:49] The way they do in other languages, and nobody seems to have had the courage to tell them, it's because the systems are completely fundamentally different.