Transcript from the "Inheritance is Delegation" Lesson
>> Kyle Simpson: By the way, this prototype system, not bad at all. It's incredibly amazingly unicorn design, it's very powerful. It's just a different design pattern than classes. It's a different design pattern which is called delegation. Now, I didn't make up this term, by the way. I've been studying the prototype system and how these things work for a long time.
[00:01:15] If you think about delegation and classes as different design pattern. Rather than saying one is bad and the other is good, I'm not saying that classes are bad. I'm just saying they don't fit in a system that was designed to be a delegation system.
>> Kyle Simpson: And we've been trying to make it fit and we keep trying to shove it in there and duct tape it to make it fit.
[00:01:37] And maybe the more effective thing is to say, hey, system, how are you designed? What amazing things can I do with you if I use the way that you actually work? This thought is not unique to me. But it has been observed that, if you're comparing a prototypal system, a delegation system, to a class system, that the prototypal system is actually significantly more powerful than a class system.
[00:02:03] And here's why, it is as if the prototypal system is sort of the super set and the class system is a subset. And here's why, because you can implement a class system inside of a prototypal language, but you cannot do the reverse. You cannot implement a prototype system in a class-oriented language.
[00:02:24] So we chose to take this amazingly powerful system and use it in one very specific way that's not even a particularly good usage of the system. And then we spent 20 years banging our heads. Why doesn't this work like it does in other languages? My response is because you're doing the wrong pattern.
[00:02:43] You can do classes. And some of you have to do classes because you work with frameworks that make that choice for you. But what I don't want you to do is walk away from this discussion thinking well, it's my only option. It's not your only option. This system exists, and there's so much untapped potential.
[00:03:02] And what I wanna dig into in our final time together in this unit, what I wanna dig into is, what can we do with delegation if we set aside our preconceptions that classes are the only design pattern that matters?