This course has been updated! We now recommend you take the Complete Intro to Real-Time course.
Transcript from the "Framework Discussion" Lesson
>> Speaker 2: I'd be curious about the answer to the other question.
>> Kyle Simpson: You would.
>> Speaker 2: That's basically just trolling.
[00:00:26] I say, the only thing that I'm an expert on is my own opinions and I'm never at a lack for those opinions. So I'm not an expert on any of this stuff, this is just I'm figuring it out and kind of sharing with you what I've learned with respect to frameworks.
[00:00:41] I wrote a blog post last fall that upset a bunch of people because I had the nerve to suggest that frameworks in production are rather a silly concept. But that doesn't mean that all frameworks are bad or that there's never a case for frameworks. I just think that they've become too quickly a crutch that we rely upon too heavily.
[00:01:03] So let me give you an anecdote to explain that. Many of you probably heard of something like Twitter Bootstrap, which is a CSS framework. It's not Bootstrap, is it?
>> Speaker 2: Yeah.
>> Kyle Simpson: Is it Twitter Bootstrap, okay.
>> Speaker 2: They dropped Twitter though.
>> Kyle Simpson: What's that?
>> Speaker 2: They dropped Twitter though.
>> Kyle Simpson: They dropped the Twitter part. Okay, so Bootstrap, the CSS framework formerly known as Twitter Bootstrap.
>> Speaker 2: There you go.
>> Kyle Simpson: That's a big giant CSS file with all kinds of cool styles for buttons and drop downs and all kinds of other UI widgets. Very few user interfaces use 100% of that style sheet.
[00:01:37] And so I was sitting around with a designer friend one night and I was asking him about this topic and he says yeah well, I start with the bootstrap CSS. And I use that to prototype out my interface cuz it's nice and fast and whatever. But at the end of the process of prototyping, once I've decided what my page is gonna look like, I go in and I rip out all the stuff out of that file that I don't need anymore.
[00:02:15] We should be using them to rapidly prototype and develop applications in a space where we don't understand the domain yet. We're still trying to figure things out and we don't want to be held back by trying to figure out, you know, console statements or whatever. We want the logging to already be handled for us.
[00:02:31] But by the point that you have evolved your app to the point where you are ready to consider it production ready, you're ready to start charging people money to use your application. I think you should have gone through a series of steps where you asked yourself, what parts of the stuff that I've deployed am I not even using anymore?
[00:02:49] There's a bunch of stuff in this framework that I'm not even using. And shouldn't I just go ahead and rip out all the stuff that I'm not using and leave only the stuff that is actually my app? That's exactly what I did with the Mario site, we used some frameworks like Backbone and some other things to kind of skeleton out what we were gonna do.
[00:03:08] But when we deployed the app I kind of tongue in cheek I said, when I deployed the app by the time we went to production. I had written a framework for the site and I just called the framework, the site. Because I left only the code that was necessary for the site and not all this extra stuff.
[00:03:24] So that's my somewhat controversial perspective on frameworks is that I don't feel that they're really as necessary as most people believe. I can find individual major problems with each one of them, but everybody can. And I think that we rely too heavily on them. I'd like to see more people leaving only what's necessary and not leaving all the extra cruft, so that's my take.
[00:03:46] Okay, let's see, we've written our server, let me double check and make sure there's nothing else that I wanted us write for forward.js.
>> Speaker 3: But would you say the same thing about jQuery?
>> Kyle Simpson: So jQuery in my book's not a framework and that's another common misconception. Let me give you an, I use jQuery.
[00:04:14] I don't use all of it, I use a tiny portion of it, but I use jQuery. Here's my little metaphor for understanding the difference between a library, a framework, and a platform. And I have very different opinions on the usage of libraries versus frameworks versus platforms. A library is like one of those old school.
[00:04:37] Some of you may never even heard of them. But we used to have maps that were printed on paper that we folded out and we kept in our glove box. And I don't know if some of you are looking at me like, I've never heard of such a thing.
[00:04:47] But old school paper maps that we had folded up inside of our glove box. A library to me is like an old school paper map that you would take when you were going on a road trip across the country. It is a tool that is available to you, but it is not in any way, shape or form opinionated on how you should get from point A to point B.
[00:05:06] It's tool that you can use, and it can be quite useful to you if you're getting lost or you need to understand what the routes look like or the roads or things like that. But it's a tool that you use along the way, and that's the metaphor for a library.
[00:05:18] And I lump things like jQuery into the library perspective. Some of Backbone is library-esque, and some of Backbone is more framework-esque, so that kind of straddles the fence. But jQuery is very much a library to me. The metaphor for frameworks that I use is it's like a GPS system in your car or on your phone or something like that.
[00:05:43] Where you've pre-typed in your destination and it's gonna give you audible turn by turn directions. That is a rather opinionated system. It has an opinion on the best route for you to get there based upon what it knows about traffic conditions and so forth. You're not required to follow that route.
[00:05:58] If you follow a different route, if you take a different turn either on purpose or by accident, it recalculates and it figures out a new thing. So it's a tool that's helping you along the way. But it's also giving you its opinion on the way you ought to do things.
[00:06:09] And I think that fits most closely metaphorically with frameworks. A platform is like an automatic driving Google car. Because it has a strong opinion on where it's gonna go, and you have very little say-so in the matter. You're just gonna go along with the flow. So if you're looking for sort of a metaphor of how I divide those things, I think about things like Ember and Angular and things like that.
[00:06:33] Those are very clearly frameworks to me. They're very opinionated. It's a very strong guidance in the way you ought to go with your app. Something like jQuery or even some parts of Backbone, they're a lot less opinionated. It's more just provide you the tools and so they're a little bit more like libraries.
[00:06:48] And then something like Rails, quite clearly that's a platform, because you've got to do it the Rails way or they're not interested in any other [LAUGH] ways of doing things. So that's just my take.
>> Speaker 2: We'll be doing a whole workshop on this. July 13th we'll be doing a compare and contrast of all the different UI frameworks, Ember, Backbone, Facebook React and.
>> Kyle Simpson: Sounds like a fantastic workshop. You should all definitely make sure to attend or watch it.