This course has been updated! We now recommend you take the ES6: The Right Parts course.

Check out a free preview of the full JS.Next: ES6 / ES2015 course:
The "History of ES6 Classes" Lesson is part of the full, JS.Next: ES6 / ES2015 course featured in this preview video. Here's what you'd learn in this lesson:

Aaron spends a few minutes describing the history of classes in ES6. He steps through Russell Leggett’s proposal that talks about how this implementation of classes needs to address the need today, but be future friendly.

Get Unlimited Access Now

Transcript from the "History of ES6 Classes" Lesson

>> [MUSIC]

>> A. Frost: So we're gonna move on to classes.t Who's stoked about classes?
>> A. Frost: See, I got one, I got two.
>> Audience1: Classes sound good, let's do some.
>> A. Frost: Three, all right, we've got classes. I'm gonna be honest with you, I wasn't. Cuz I started working in JavaVille, where it's like, horrible service implementor factory service proxy.

[00:00:38] You know like, why did you name it that? That's the worst possible name you could have named it. And so I'm like, dude, Java if I ever have a JavaScript object that's named com.frontendMaster', I'm going to give up, I'm moving to another country. I got really scared that was going to happen, and it is gonna happen.

[00:01:02] Like, who doubts it? Who doubts it? Just for the record, no one raised their hand. It's gonna happen, and so I am nervous. I am nervous about that. It think the community, though, will fight it back and keep it down to a minimum. Which so I got over it.

[00:01:16] But then once I learned you can extend built in functions like built in objects, I thought that could be cool. Like an array, I could make my array, and it just extends array and I could I could make the array.push function. I can make it return the array itself.

[00:01:37] So I could daisy chain like, .push, .push, .push, I could do a bunch of things like in the in line. Which might have to do array.push, blah.push, know what I'm saying? I could extend and do my own stuff. Maybe I could use classes to make something that's easy to read because, let's face it.

[00:02:02] Well I'll get into it, but, so now I'm actually pretty excited about it. That count? All right, I don't think the chat's listening, so let's hurry. Okay, so the history of classes in ES6. It goes back to the ES4 days and we know this, because Adobe's like we're just gonna implement it on our own.

[00:02:22] There's been lots of Churn. There's lots of precedence in most other languages to have, like, a formalized class system and not prototype inheritance. So they're sitting there and they're like, fighting, right? And we've talked about the big gap and the fallout. And it's interesting, Brendan Eich actually, here's a little tid bit.

[00:02:41] I'm going to tell it fast. I can actually when they fell out and they couldn't agree anything it was like a fight he actually calls that, A Fellowship of the Rings. Cuz he's like you know how in Fellowship of the Ring, they're all like, we're all going to do this together and then they all go their own way.

[00:02:54] Like he's like the it's the Fellowship of the Ring. We all end up breaking up at the end. And, it's funny, one thing I didn't tell earlier. So, the ES3 camps got to give up and accept the ES4 proposals, right? Or the other way around the ES4 camp got to give up and accept like to push the ES4 and just do the ES3 stuff for now, right.

[00:03:18] So that's what happened was, the ES4 camp as like, cool, we give up, we'll do the ES3.1 thing for now, and we'll move on. So Microsoft is in the don't do ES4, let's just do the 3.1. So Allen Wurzbach, he comes over to Mozilla after that. He's at Microsoft, goes to Mozilla.

[00:03:38] And he's like dude, we almost gave in to your demands, we were about to give up, when you gave up. So just like if we were like this close to having all this stuff back in 2008. But, the cards feel like they fell. And we're at where we're at today.

[00:04:00] So anyways, so, there's a lot, and the heart of this conflict is like this strong type system, and getting something going. And they still, to this day cannot agree on it. And when they can't agree on something, remember what I already said when the TC39, they can't be like, this is how it works, clearly that's how it works.

[00:04:17] What happens? It gets pushed to the next release, right? Like so and they were like, it causes were never going to make it in the ES6, ever. Okay, like it's not gonna happen. But then Russell Leggett he sends us email, on March 19th, 2012 and, he's like hey, you guys should read this.

[00:04:38] It was an excellent email, okay? And he copies a bunch of code, off of coffee Scripts' website, and, he really kind of was like, hey everyone chill out. This is what I think we need to do, and everyone, not immediately because there's like a lot of discussion. If you click on the thread.

[00:04:58] This is where the thread starts. And it was a huge thread that month. Everyone's in it, and it's like the big names Brendon and Russell and Allen and Dave Herman. Like,epic dudes. Anyway, so it was a cool email. And if you want to, go back and read it.

[00:05:18] But this is kind of what he talked about. He calls it, maximal minimal classes. Maximally, I forgot the Y, Maximally minimal classes. And he points out the need for classes like, dude look we've needed this for so long. People invented things like Coffee Script, because we've delayed so long.

[00:05:40] So, like he kind of points out, there's a series the people are doing compile to JS stuff because of it right and we have like typescript and stuff. So he points out a strong need for classes for something that's not the prototype stuff. And he's like we get, it has to be enhanceable by future releases.

[00:05:57] So whatever we do release, it has to be minimum viable that we can extend, okay? If anything's not extendable, we have to cut it. Or if we're not one 100% sure on something, it's out. Everyone's like okay, that's cool. And he points to Brendan, cuz Brendan's over there and he's like, hey, we got this.

[00:06:20] He called Brendan's proposal the Goldilocks proposal, because he's like you know, it's not too hot, it's not too cold, it's just right. And that was Brendan's point of view, was like, not too much classiness, not too little classiness, but just the right amount of class syntax and we're good.

[00:06:36] And they could never agree on that. So he comes up with his Safety School Proposal. And so the Safety School Proposal, he's like, in the States, we have this idea of you graduate high school, and you send off your applications to the schools that you want to go to, right?

[00:06:53] Who did that? I didn't, but maybe some people did. And he's like, but then you always have like the safety school. So when all other things say no you have this safety school, and you can at least go to the safety school. He's like, that's what we need to focus on, is the safety school.

[00:07:08] He's like, we've got to come up with the minimum viable product that we can release. I know you guys want an Ivy League class system. But what's the safety school system look like? What is that one? And so that's kind of what he proposes out there. And he's like, if we have to have something ES6.

[00:07:28] So what is that. What's the things we can agree upon sans the stuff that we can't. Let's just talk about what we can agree upon. And so he wins out. Obviously, I showed you not easily, it was a real long conversation, but he did win out. I mean, people pretty much adopted that safety school proposal, the maximal and minimum class system.

[00:07:48] And that's what got implemented, was that. So the things we're about to see are the things everyone agreed on. The things people can't agree on, we're not gonna see that. So everyone's gonna hey what about the thing and I'm gonna say it's not a thing yet, it's still being discussed.

[00:08:05] And if there was a feature that you are not gonna see, go ahead and call it out and let us know, but there's a lot of stuff not here. But I'll try and show you the stuff that is here