00:00:00,230 --> 00:00:03,300 VIDEO: Quickly thereafter to see where we spent a lot of the semester. We have since pivoted to Python, of course. Who's syntax is quite different but whose ideas are really fundamentally the same. DOUG LLOYD: This is like watching the CS50 explained right before our eyes. DAVID MALAN: Indeed. And why we did everything. Well let's now explain the explanation. I'll admit I've always had misgivings with the extent to which we cover JavaScript. Because I don't think we do that language justice. I mean similarly, do we not dive super deeply into Python. But in my mind, we would be remiss in introducing students to the world of web programming. And having given them something so server side focused. And giving them the ability to store data in a database. If we don't also give them the ability to make better user facing interface design decisions with the client side language like Java. DOUG LLOYD: No, that's a fair point. If you're building a website and your user experience is less than satisfactory, then your website's probably not going to last too long. DAVID MALAN: I know. We spend so much of the semester building and building and building to get students to the point of familiarity with everything around them. And then to stop short of giving them a bit of introduction to the language in which any client side library is going to be written in, or any client side framework. We would be remiss, I think. And so that's why we do introduce JavaScript. But much like our Introduction to HTML, CSS, also Python, and SQL. We try to focus on the fundamentals. So there's a nice mapping from C to Python. A nice mapping from C to JavaScript. So we very quickly go through that to reassure. There's nothing really conceptually new, at least so far as the basics go. DOUG LLOYD: The syntax is with tiny little tweaks here and there. DAVID MALAN: Indeed. But there are some juicy opportunities to discuss event driven programming. So actually listening for clicks, mouse drags, and mouse movements. DOUG LLOYD: Which is actually pretty great. Because it's a tieback all the way to week zero where we do that actually in Scratch. DAVID MALAN: With events in Scratch, the first week we introduce that. And then more sophisticated topics still like anonymous functions. Which you can see in Python 2 that we don't introduce them in that context. Functions that can just be called without knowing their name. And closures in JavaScript 2, which might otherwise trip students up. Though we don't dwell on that particular topic. DOUG LLOYD: Callbacks. DAVID MALAN: Callback functions, which is a great paradigm. Super prevalent throughout a lot of JavaScript programming. So we try to at least give them that vocabulary. In addition to an exposure to my [INAUDIBLE] website from 1997 or 1998. DOUG LLOYD: One of your first major projects. DAVID MALAN: There is a little bit of JavaScript then. That's how we did the mouse over on the images up top. You can do so much more now. Ajax, of course, explaining asynchronicity and slightly fancier topic still that they might see in higher level classes. And talking about those interactions with the server. So we really don't spend that much time talking about the language as we do use it as a point of departure for some of these more sophisticated topics. DOUG LLOYD: Right. And the only thing that we dive into beyond the fundamentals of the language itself, is the very popular jQuery library. Because you're so likely to see examples, not only in straight Javascript but also in jQuery. And it's so prevalent that we deliberately take the time to introduce students to what it looks like. Because it can look a little strange if you're not familiar. DAVID MALAN: It is in there too. I wish we had a little more time. But it quickly becomes, I think, pretty mundane. And so I'd rather we focus on the ideas and less on the syntax and the particulars of even something like that. And that too is one of the few examples of popular libraries we're introducing. We introduced bootstrap a couple of years ago. Just so that students have a little more expressiveness and easier expressiveness with styling their front ends and so forth. But even the examples we give in JavaScript, we use it in our earliest examples to do form validation. So a very omnipresent feature of most websites, many websites these days. But we talk about how it's implemented. And how you can model the underlying DOM, or document object model, as a tree just a couple of weeks prior. When we talked about that data structure. And how you can register event listeners to listen for changes. How you can mutate the DOM by adding nodes. So there's a lot of juicy ways of tying things together here even without getting caught up in JavaScript specifically. DOUG LLOYD: Yeah. I mean even some of the examples that I would show in section. They usually involve clicking different buttons to change the color of things on the page. So it allows you to again reintroduce events, to talk about CSS again. And show how CSS can be manipulated and represented in and controlled by the DOM in JavaScript. The thing that I love about week 10 and JavaScript is, it really does, when you think about it, allow us to circle back and hit almost all of the major points that we've explored along the way. And just show that these concepts are pervasive. And they do show up in every language. Even though you've spent half of your term learning one of them in great detail. And the other half of the term learning about half turns and ways to expand on those. DAVID MALAN: And after all, students only have one more week in the class besides their final projects. And so this approach of spending less and less time on each language, I don't think is necessarily a bad thing. If our goal is to really empower students to teach themselves new things. So I think guiding them through the right mental paradigm to have for this language. Client side programming, in this case, is a helpful helping hand to have. But beyond that, I think, learning the nuances of this language or some subsequent language might as well be in the students court. DOUG LLOYD: And that we do touch on so much in the second half of the class really does speak to the philosophy that we both share. Which is that this class does not teach you C. It teaches you how to program. It teaches you the skills you need to go out and learn to do so much more. Build upon the things that you've done in CS50 to create great things.