[MUSIC PLAYING] [MUSIC - BIRDY, "KEEPING YOUR HEAD UP"] MUSIC: Times that I've seen you lose your way You're not in control and you won't be told All i can do to keep you safe is hold you close hold you close 'Til you can breathe on your own 'Til you can breathe on your own Hold tight you're slowly coming back to life I'll be keeping your head up I'll be keeping your head up darling Let go of all your haunted dreams tonight I'll be keeping your head up I'll be keeping your head up darling Hold tight you're slowly coming back to life I'll be keeping your head up I'll be keeping your head up darling Let go of all your haunted dreams tonight I'll be keeping your head up I'll be keeping your head up And I won't let you down [MUSIC PLAYING] DAVID MALAN: This is CS50, week 11, for the final time. And it is of course, this weekend, Harvard-Yale, and in full disclosure, we actually spent yesterday at Yale wrapping up the course there as well, but we did think this was perhaps an opportunity to make a few changes here for today's lecture. Now, now to be fair, we suck. But we thought we'd use this as an opportunity to take a closer look at this problem that was solved by some of our friends in New Haven just a few years ago in honor of this weekend's event. A closer look then at, if you will, problem solving, DAVID AULICINO: We're headed up to Boston, checking out the stadium for the prank. A few years ago, I was at a math conference, and I was sitting around the table at dinner with a few other mathematicians. And one of them went to Harvard and started telling the story of this amazing prank that was against Harvard. And at that point, I felt I had to interrupt, and said well, actually I can tell you a lot more about that. OK? MIKE KAI: OK. SPEAKER 1: The idea was perfected in a dorm room. MIKE KAI: Came up with the idea, actually, to prank them with signs at the football game. We threw some ideas out there as far as what the signs would say. We eventually settled on "We Suck." DAVID AULICINO: And my immediate reaction was no, this will never work. , However, the problem solver in me started thinking, well, maybe we can make this work. SPEAKER 1: The problem? They had to infiltrate Harvard stadium without getting caught, sneak in 1,800 placards, distribute them to unsuspecting Harvard fans, and then convince those fans to prank themselves. MIKE KAI: That's great. We thought about basically every possible thing that could go wrong and try to come up with a solution for it. DAVID AULICINO: And then you put two reds on top of it. SPEAKER 1: They made fake Harvard IDs and fake backstories, fake placard designs, and a 28-member fake pep squad. AUDIENCE: I can see the shirt. SPEAKER 1: On November 20th, 2004, the fake Harvard students smuggled the placards into the game. AUDIENCE: What do you think of Yale, sir? AUDIENCE: They suck. [MUSIC PLAYING] AUDIENCE: It's not going to say something like Yale Sucks, is it? AUDIENCE: It says Go Harvard! SPEAKER 1: But then, trouble. AUDIENCE: What houses are you guys in? That's not a real house. AUDIENCE: Ho-fo? AUDIENCE: You guys aren't from Harvard, are you? Because I really think you guys are from Yale. DAVID AULICINO: I just showed him the front of this ID, and all of a sudden he just ran away, and he felt so embarrassed. SPEAKER 1: Having escaped one confrontation, they couldn't risk another. It was time. MIKE KAI: This just looks like a total mess. We have absolutely no idea if this is going to work. AUDIENCE: Look at them, they have the paper. It's gonna happen. It's actually gonna happen! I can't [BLEEP] believe this. SPEAKER 1: What was once a prank became a legend. AUDIENCE: We [BLEEP] did it! MIKE KAI: And immediately, we started hearing chants from the other side, "You Suck." AUDIENCE: You suck! You suck! You suck! MIKE KAI: And I think it was at that point in time that we knew we had pulled it off. AUDIENCE: One more time, come on Harvard! AUDIENCE: There it goes again! MIKE KAI: I really think it didn't matter that Harvard won. Because of the prank, for a lot of Yale students and alumni, we definitely won that year. DAVID MALAN: Best of luck to both teams this weekend. We thought that we would participate in our own CS50 way. This game was something written in scratch some years ago now by one of your predecessors, and I thought we would go head to head here with Yale if we could, with one volunteer who is willing to come up and represent Harvard in this game. Someone? Anyone? Not too many people all at once. No? Actually, would you with the Harvard sweatshirt like to play this game? Could we get you to come on up? Are you comfortable? Yeah, all right, come on up. This could not be more perfect. What's your name? DIANA: Diana. DAVID MALAN: Diana. Nice to see you. Come on up, Diana. So here, as you see, we're about to hit the space bar, and the instructions will appear on the screen, if you'd like to play my keyboard here. And the goal is simply to move the Harvard crest to the goal again and again without getting hit by the other team. DIANA: OK. DAVID MALAN: Sound good? And just arrow keys. Up, down, left, right. Surprise. Let's actually open up the game. That was a slide. [MUSIC PLAYING] There we go. [MUSIC - MC HAMMER, "U CAN'T TOUCH THIS"] MUSIC: You can't touch this Can't touch this Can't touch this Can't touch this DAVID MALAN: Nice. You have your fan. MUSIC: My music hits me so hard Makes me say oh my lord Thank you for blessing me with a mind to rhyme DAVID MALAN: Two Yales now. MUSIC: When you know you're down A super-dope homeboy from the Oaktown And I'm known as such And this is a beat uh, you can't touch I told you homeboy Can't touch this DAVID MALAN: Very nice. Level five. MUSIC: Look at my eyes man Can't touch this DAVID MALAN: Nice. MUSIC: Fresh new kicks and pants You got it like that now you know you wanna dance DAVID MALAN: Level six. MUSIC: Out of your seat And get a fly girl and catch this beat while it's rolling Hold on pump a little bit and let them know it's going on like that Like that cold on a mission so fall on back Let them know that you're too much And this is a beat uh, they can't touch DAVID MALAN: Oh! MUSIC: Told you, can't touch this DAVID MALAN: Nice, yes, yes. Level seven. MUSIC: Can't touch this Give me a song or rhythm Making them sweat that's what I'm giving them now They know they're talking about the Hammer DAVID MALAN: That's level eight. MUSIC: Singers are sweating, so pass them a wipe or tape To learn what's it gonna take in the 90's to burn the charts DAVID MALAN: Oh! MUSIC: Either work hard or you might as well quit DAVID MALAN: Oh, still level eight. MUSIC: You can't touch this Break it down DAVID MALAN: Yes. Level nine, second-to-last level. [MUSIC PLAYING] MUSIC: Stop, Hammer time DAVID MALAN: Death at five. MUSIC: It is said if you can't groove to this then you probably are dead DAVID MALAN: That's OK. MUSIC: Run your fingers through your hair This is it For a winner DAVID MALAN: One level to go after this, yes. MUSIC: Slide your rump Just for a minute let's all do the bump Yeah, can't touch this DAVID MALAN: OK. MUSIC: Look, man Can't touch this DAVID MALAN: Yes! She doesn't want to go run the [INAUDIBLE].. MUSIC: Break it down DAVID MALAN: On level nine. I didn't do better. Okay, nice. Yes, oh! Oh, don't give up yet! Yes, yes! Hang in there. Let's give it another one or two more deaths? Hang in there. MUSIC: Can't touch this DAVID MALAN: There we go. Come on, Diana, come on, yeah! One more, one more. MUSIC: Stop, Hammer time Every time you see me The Hammer's just so hype I'm dope on the floor DAVID MALAN: Hang in there. MUSIC: Now why would I ever DAVID MALAN: Come on. MUSIC: Stop doing this When others making records that That just don't hit I've toured around the world DAVID MALAN: Try a couple more times. MUSIC: It's Hammer Go Hammer MC Hammer DAVID MALAN: What's that? I think you just-- luck. MUSIC: Can't touch this DAVID MALAN: One more life? Two more lives? MUSIC: You can't touch this Yeah Can't touch this I told you, can't touch this DAVID MALAN: Yes, oh! One more, one more, one more. MUSIC: We outta here Can't touch this DAVID MALAN: Yes! Yes! All right a big round of applause for Diana. Congrats. Thank you. All right, so we will post the link on the course's web site if you would like to try your hand at that as well. Before we forge ahead though, a big thanks to CS50 50's whole team. Suffice it to say, with office hours and sections and the problem sets and, soon, the CS50 hackathon and fair, we truly could not do it without all of these faces here, all of the faces behind you today, and the whole team online. So if we could, a big round of applause for CS50's team. Allow me to call out a few folks in particular. One, these are all of the names of CS50 50 staff, both here and afar, helping to make this course possible. CS50 50's production team, of course, making it possible for you to tune in across campus or across the world, and then, some folks too that might be more familiar over the course of the semester. CS50'S 50's own Doug Lloyd, who not only has been the longest-serving staff member for the past 11 years now, he was also here on Jeopardy some years ago, and won. So that was amazing to watch on TV. CS50's own Rob Bowden, or that guy in Thayer from whom you might have gotten some help over time, since he is a proctor there. And of course, perhaps the most familiar face of all, CS50's own Zamaila from the problem sets. And then of course, today's performer, playing out, if you will, problem set three for us, Brian. A big thanks to him as well. And then a special final thanks to someone particularly special. CS50's own Maria, who has been with the course now in some way for four years. Sadly but excitingly, Maria is about to go off into the real world, working as an engineer at Facebook, but she actually took CS50 here as a first year years ago, and then is among the longest-serving members of the course's head's team in that she's been with us now in some form for the past three years. And in fact we went through some old footage and, in fairness, one of her friends actually found this, an old video from her freshman year years ago. This was Maria like, right here, volunteering some years ago. So if we enhance this here, a big round of applause especially for Maria. She will be missed, as of course will you. This is week 11, and so this is where we promised we would get to. And indeed, especially on the heels of a little quiz that you might have taken or finished yesterday on what is ultimately, what does ultimately matter in this course is not so much where you end up relative to your classmates, but where you end up relative to yourself today and next week and beyond, relative to where you were in week zero. So we do hope that you have gotten an extraordinary amount of time back now from this class, but also a huge return just in terms of the concepts and the practical skills we hope you can now bring to your future studies in CS, or if you exit CS at this point to your own domains and can solve problems all the more effectively. And in fact, if you're curious as to how some of your classmates have labeled themselves over time, this is where, in week zero, you all were with the majority of the class describing themselves as less comfortable. And if you're still feeling a little bit that way, rest assured some 12 weeks later, none of you are among those less comfortable anymore. Everyone has been upgraded as of today to somewhere in between or more comfortable. So do realize, that too has been a stepping stone. And in fact now, even if you are currently a first year, or we've had high school students in the past or a junior and a rising senior realize that the opportunities ahead, not only to study other courses in CS, but to teach computer science, TF-ing or CA-ing for CS50. Hands down, the most effective way to learn this kind of material, and perhaps any other is to actually teach it, and that's certainly true for me and for Maria and Brian and Zamaila and Doug and Rob, and the whole of CS50's team here. I mean in fact, some of them with CS50's production team wanted to share with you an invitation to join us in some form on campus this coming fall 2018 online. In the meantime, we're in any number of other ways. If we could dim the lights for this invitation from the staff. ALAISHA: I'm Alaisha. DANIEL: My name is Daniel. ATHENA: I'm Athena Braun. ALAISHA: I'm a sophomore. THOMAS: I'm a senior. BRIAN: I'm a junior studying computer science and linguistics. ALAISHA: I'm concentrating on CSO. ALLISON: CS50 is also just because it's changed my life. It made me a computer science concentrator. ALAISHA: I am a TF for CS50. ALLISON: Course assistant. ATHENA: This is my second year TF-ing now. THOMAS: This is my third year being a teaching fellow for CS50. ATHENA: Becoming part of CS50 staff helped empower me so much. ALAISHA: I was a total beginner, never anticipated programming beyond CS50, but here I am. It was just something I never thought I would do. I think it's just been really exciting going from being a beginner to being comfortable enough to TF this class. MARIA: Everything that has come out of this has helped me grow so much as a teacher, as a student. DANIEL: Also, the culture and the environment of it is also pretty unique. ALLISON: Definitely found a community of friends within the CS50 staff. ATHENA: Be prepared to have students who look up to you and really appreciate the work that you're doing, and just realize that you're not just a teaching fellow. You're not just this person behind the whiteboard. You're a student who took this too, and can really level with other people in your section and figure out what's going on, and make it a good experience for them. DANIEL: I decided that I can get the best of both worlds. I can get to teach about computer science, and those are two of my passions. THOMAS: I just really love teaching computer science to beginners. CS50 is where all that beginner energy is, and that's where I can make a real impact on the students careers in CS. BRIAN: It's amazing to see how much this course can do in just a semester, and how from September until December, students learn so much and gain so much experience and knowledge. And watching that and working with them in that process has always been really, really inspiring. MARIA: It's been so, so wonderful getting to see these people grow just like I did myself. THOMAS: One of the most rewarding things I've done here. That's why I keep coming back. DANIEL: Going to office hours and helping people out, it makes you feel good, and it makes other people feel good as well. BRIAN: My name is Brian. THOMAS: I'm Thomas Lively. ALLISON: I'm Allison. MARIA: I'm Maria, and this is CS50. DAVID MALAN: So in the coming weeks, please do feel welcome and encouraged. Even if you were among those less comfortable and still kind of think you are, that is undoubtedly not the case, because amongst CS50 staff are students who have just taken the course a year or two or more prior, you potentially among them. And in fact there's other opportunities to get involved as well. In addition to the on-campus class here, we of course have our friends in New Haven, but even beyond, the CS50's team work with communities around the world. In fact, every red dot on this map here represents a high school where there's a high school teacher and class of students who were taking CS50 in some form, where their own teacher has adopted or adapted the curriculum, the same tools, the same software that you all use here in Cambridge and in New Haven to actually teach introductory computer science as well. In blue, similarly, are universities around the world as well where we've been working with faculty and student groups beyond. In fact, here some of our friends in Miami-Dade College in Florida. Some of our friends here in Chile, here in London, here in Burma, here in Ukraine, here in Cairo, here in Bolivia, here in Nicaragua. And lastly, here on stage, our very first cohort, so to speak, of high school teachers teaching CS50 AP as of a couple of years ago, who then went back through their school districts to evangelize computer science and empower students there to teach it. And in fact, even though we ourselves have our own hackathon coming up here in just a couple of weeks' time, so has there been a CS50 hackathon for high schools. In fact pictured here, was our very first CS50 hackathon for AP students, a mix of four public, four private schools in Manhattan some months ago, where everyone got together to work on their own problems sets, projects and the like. So again, please feel free to engage in any number of these ways and more. So what did we do all semester, and what will you do if you continue to apply CS? It's really all about problem-solving, and we've certainly solved quite a few problems, the last of them last week with problem set eight. If you're curious as to what your classmates thought of the problem sets, here we have blue means love, and purple means hate, and each of these bars represents problem set zero through eight. So you can kind of get a sense where the love, where the like, where the neutral was, here in yellow. And maybe there are some spikes of hatred, maybe over down there. But perhaps more revealingly too is the difficulty with which folks perceive these, and this admittedly is retrospective. So of course scratch was pretty fun, pretty easy, as was maybe Mario and so forth. But you can get a sense of some of the fluctuation. And apparently, on the heels of misspellings here, we suddenly went to a lot of medium difficulty when you simply had to port, so to speak, some of your problems from P-set one now for problem set six. And in terms of demographically, how your classmates are engaging in the class, when did you start problem sets? Oh interesting. So recall that problem sets are released on Fridays, and here we have Saturday, Sunday, Monday, Tuesday. Oh hello, Wednesday is when really a plurality of students seem to begin their problem sets. Not though perhaps surprisingly, when it coincides with office hours and sections in the earlier days of the week. And then in terms of when you watch lectures, because indeed, both here and in New Haven, most students, they do engage online. You can see that, with the lectures live on Friday, many students watch apparently shortly after 10:00 a.m. on Fridays, but on demand, followed by the weekend, and the most popular being Monday before sections presumably. So you too are somewhere among those inputs. But what were the problems that we actually solved, and what were really the goals of the class? It's not to teach C per se. It's not to introduce JavaScript or SQL or Python, all of which are really just tools in a toolkit. So that when you exit CS50 and go onto some other class or some other field, and want to actually solve problems using data and using computation, that you actually just have a mental model with which to approach it, and less of a fear factor. So that even if you have absolutely no idea how to write code in Ruby, which your lab or your company, your friends, happen to be using, well, no big deal. Much like in P-set seven and eight, where Google and Stack Overflow and friends become your support structure, realize that among the goals has been to teach you to teach yourselves. And undoubtedly, that comes with some frustration, in especially those recent weeks, but the goal really has been to take off these training wheels, so that when you're no longer handed a spec for P-set zero through eight, you at least have a sense of where to go from here. And indeed the final project is about taking off the final of those training wheels. Now what does problem solving itself mean? We described that back in week zero as this. You have inputs to that problem, and at the end of the day you care about the outputs, and what was inside of this black box, so to speak. So algorithms, just step-by-step instructions for solving some problem, and that's where the real insight is, the real efficiency and the real opportunity to get things not only correct, but also well-designed in addition to something like well-styled. And so as you approach the solutions to problems, I dare say maybe one of the most thematic topics of this class, and perhaps any other introductory class, is this theme of trade-offs, whether it's time and space, or the computer's time and space versus your time and space and so forth when solving these problems. And consider that there's not necessarily one right answer to these kinds of design questions, but hopefully you'll feel all the more that you can hold your own in a conversation with someone as or even more technical than you and convince them of your perspective and contribute to the solving of some of these problems. And among the other topics that have been sort of manifest throughout the semester is this one, abstraction, which really speaks to this very general problem-solving tool. If you've got some problem ahead of you, whether it's something software-related or real-world, or really anything in between, this idea of taking something complicated and breaking it down into its constituent parts, so that you only have to think about up at this level, and you don't have to worry about where the zeros and ones come from, or where the characters on the screen come from, and so forth. Like the fact that we've kept layering and layering and layering means you could do so much more with P-set seven and eight. Even if it didn't feel like it at the start of the week, then you could with just C and certainly with just binary alone. So realize too, that sort of bootstrapping is thematic any time you're learning some new topic. And how do you express yourself when trying to solve these problems? Of course pseudocode. And indeed, this should become habit as well. Doesn't really matter what language you write in, but I am still in the habit of writing out comments for my programs, and then therefore I kind of know the outline, much like an English essay, and then I kind of fill in the gaps with the actual code thereafter. Because the hard part, and perhaps the fun part, is really just thinking through how you might solve something. And in fact this was, this feels like an opportune moment to take a moment to see just how well this has sunk in, and how well we might apply some of these most basic principles that started in week zero and then persisted throughout. But for this, we need a volunteer to come up on stage and help me program everyone else. Yeah, come on up. All right. What's your name? Sorry? Amy. Amy, come on up. Nice to meet you. Now only Amy is about to see what's on my screen, and if the staff could help me for just a moment. Let me go ahead and cut to this. I'll be right back. We just need to quickly hand out all this paper. You can pull out a piece of paper of your own if you have it, but if the staff could kind of divvy these up so that everyone has a piece of paper. Ideally, a pencil or pen. If you don't, we have, pardon me, Amy. A solution to that problem. Everyone gets a free CS50 pen today if you'd like. OK, very popular. OK, so no one has a pencil now, apparently. All right. So Amy, as you guys get set up up there, I'm about to show Amy something on my screen, a picture to draw. And you, much like the programmer that you now are, are going to program the audience to actually draw what you see. And we'll remember, from very early on, that precision is probably important here, but at the same time, you don't want to get tangled in the weeds of zeros and ones so to speak. You want ultimately everyone in this audience, ideally, to draw what it is just you and I are seeing. All right, so everyone is unwrapping pens. And hopefully you have a piece of paper, though any piece of paper suffices. I'm going to go ahead and reveal what Amy is seeing here. And the goal is, verbally only, to tell the audience here what to draw. And give everyone just a moment. Get your paper in front of you, pencil in hand or pen in hand. And feels like we can begin. AMY: OK, so I'm looking at a cube. It's kind of like a Rubik's cube, but I can only see three of the faces. So there's a, this, oh. So there is the top of the Rubik's cube and two sides. The top looks like a diamond, so you want to draw the diamond on the top. And then the two sides come down from that, so it looks like you're looking at a Rubik's cube from the corner. And it's not actually Rubik's cube, so don't draw the lines. It's just like a normal cube. I don't know how else to describe it. DAVID MALAN: Exit? AMY: Exit. DAVID MALAN: OK. So thank you so much to Amy. Round of applause, if we could, for getting us to this point. Now comes, feel free to partake back down there. Now we just need that staff to help grab some of these pieces of paper. We'll do pseudo-random samples and we'll take a look at correctness, if not artistic design here. Some folks still going past the buzzer, but that's OK. All right, I'm going to go ahead and cue up my screen here. In just a moment, we'll actually reveal how some of these came out. All right, that's good. Thank you so much. All right, so notice in particular though, that what Amy was doing was actually leveraging abstraction, as it turned out. Right? She was telling you to draw shapes that are hopefully familiar, toys that are hopefully familiar, and those of course are abstractions. Because it would get pretty mundane and pretty low-level if she had to start describing what a Rubik's cube is or what a diamond is. Hopefully these are abstractions all of us know, at least the diamond shape and so forth, and the cube shape from yesteryear, so at least we have that same mental model. So let's take a look at a few of the shapes that we have here. Here, we have one, two, three attempts to draw, but that perhaps is reminiscent of what some of you drew as well. This one here is super small. We didn't really speak to scaling, but that does look like a cube. Perhaps not necessarily oriented as she intended. This one's kind of cute. But we love them all equally, whoever's this is. In fairness, this one's sort of Inception-like. Or, oh I see. Diamond on top of the cube, I get it. This one's a little bloated at the bottom. OK, this one's actually quite beautiful. Here we have this one here. Very nice. And I think she was describing it this way. And in fact, if I go back to what Amy was seeing, the answer was this one here. So a big round of applause, if we could, for Amy. But now, let's flip things around. Here we need one more volunteer to come on up if you could. OK, come on up. And what is your name? Dylan. Dylan, come on up. So here, we'll turn the tables a bit. Thank you so much. Welcome to keep those pens and the sheets of paper if you still have them. Let me go ahead here and blank the screen again and give Dylan a piece of chalk if we could. And so if you could come on over here, what we have here is a canvas on which you can draw what the audience tells you to do. And in fact, since the answer is going to be there, we're going to push this back after all. And the only thing you can't do is look up. All right, so look straight ahead. Here's your piece of chalk. And now, what the audience is going to see is what you need to draw, and we'll take it one instruction at a time to tell Dylan what to draw. All right, the drawing is-- Who would like to contribute the first instruction? And also don't look to your right, because there are answers everywhere. Yes. AUDIENCE: Draw a circle in the middle of the board. DAVID MALAN: Draw a circle in the middle of the board. AUDIENCE: Smaller than that. DAVID MALAN: Smaller than that. There you go. AUDIENCE: Erase the big circle. DAVID MALAN: Erase the big circle. AUDIENCE: Draw a line going down the circle. DAVID MALAN: Draw a line going down the circle. OK, wait, we need to buffer, buffer. Hang on. No. Undo. OK, let's restart. Step one, draw a-- AUDIENCE: Draw a small circle in the middle of the board. DAVID MALAN: Draw a small circle in the middle of the board, Dylan. AUDIENCE: Keep it. DAVID MALAN: Keep it. We'll take it. OK, step two. AUDIENCE: Stick figures with no arms yet. DAVID MALAN: Draw a stick figure with no arms yet. Nice abstraction. AUDIENCE: The head is the circle. The circle's the head. DAVID MALAN: OK, step three. AUDIENCE: The circle is the head. DAVID MALAN: What's that? The circle was supposed to be the head. OK, version two, step four. Step four? Step four? AUDIENCE: From the bottom of the circle, draw inverse Y. DAVID MALAN: From the bottom of the circle draw an inverse Y. Step five. AUDIENCE: Stemming from the head, the body and the legs are the same height or length. DAVID MALAN: Stepping from the head, the body and the legs are the same height. AUDIENCE: So, draw the body first, and it will look like a Y. DAVID MALAN: So draw the body first and it will look like a Y. AUDIENCE: [INAUDIBLE] stemming from the body. DAVID MALAN: After erasing everything else, I heard. OK, nice. [INTERPOSING VOICES] Erase the mustache. OK, step six. Step six. AUDIENCE: Draw a V the same way. DAVID MALAN: Draw a V the same way. AUDIENCE: From where you started with the Y. DAVID MALAN: From where you started with the Y. AUDIENCE: Right side. DAVID MALAN: On the right side. No, no. [INTERPOSING VOICES] No. Do the opposite of that. AUDIENCE: Downward V. DAVID MALAN: Downward V. AUDIENCE: It's one of his arms. DAVID MALAN: It's one of his arms, AUDIENCE: His right arm. DAVID MALAN: His right arm. [INTERPOSING VOICES] His arm. OK, step seven? [INTERPOSING VOICES] Draw the what? [INTERPOSING VOICES] Draw the second part of the arm from the elbow. AUDIENCE: Continue to draw a line from the elbow DAVID MALAN: Elbow, elbow. Elbow, yeah. AUDIENCE: The arm on your right, make it a V. DAVID MALAN: On the arm on your right, make it a V. OK, yes. OK, we'll take it. AUDIENCE: Yes. DAVID MALAN: Yes, OK. Almost there, almost there. AUDIENCE: And then the other arm-- AUDIENCE: Make the other arm touch, put his hand on his hip. DAVID MALAN: Make the other arm put his hand on his hip. Yes, and last step maybe? Second to last? Yeah. AUDIENCE: Say at 11 to 10 o'clock, draw-- DAVID MALAN: Say at 11 or 10 o'clock-- AUDIENCE: Yeah, from the circle. DAVID MALAN: From the circle. AUDIENCE: Look at the circle as a clock. DAVID MALAN: Look at the circle as a clock. AUDIENCE: And draw a line as big as one of arms. DAVID MALAN: And draw a line as big as one of the arms. AUDIENCE: Put a space. DAVID MALAN: Put a space. Yes. Last step. Yes, over here. AUDIENCE: Write hi above it. DAVID MALAN: Write "hi" above it. AUDIENCE: Capital H. DAVID MALAN: Capital H. And congratulations to Dylan. That's pretty good. Pretty good, thank you so much. So realize, fun as this is, it's actually non-trivial to convert these abstractions with which we're familiar to things that computers, or in some cases humans, actually understand. So realize here too, there's this trade. Like, saying draw a stick figure is a very useful abstraction, but the problem, of course, is that the precision isn't necessarily there if you're seeking one particular goal. So beyond problem solving in this way and in this class what more can you do after CS50? So if you take a look at that unofficial guide to CS that we'll link soon on CS50's website as well, you can go off in so many other directions from here to the direction of hardware, software, graphics, theory, statistics, mathematics, and more. And indeed increasingly, to the intersection of computer science with other worlds, like economics and now machine learning, which is being applied to all sorts of fields as well. And in fact even I years ago have very fond memories of some of these classes and only a handful of these even existed years ago. I still remember to this day taking CS141, which is a hardware class, and even though these days much of it's been virtualized in software, back in the day we had tiny little wires and tiny little breadboards, and debugging back in my day was literally a matter of grabbing all of the wires that had just frustrated you to no end and literally ripping them out of something called a breadboard and starting over. Nowadays you can do so much more in software, and can conceptualize things all the more effectively because of enhancements since. And perhaps after CS50, one of my favorite classes, probably my favorite class as an undergrad, was CS161, an operating systems class. We actually build pieces of an operating system which would be akin to the features of Mac OS and Windows and Linux and the like. And so realize even if you're among those less comfortable, there's so many different stepping stones. So do chat with your TF or myself or the course's heads or any of the CAs about what directions in which you might go. And even if you don't have the time or necessarily the interest on campus in doing these things, there are so many courses online beyond this particular campus too, on EdX and Coursera and the like so don't under appreciate the ability now to go teach yourself new things albeit with the structure of some of these freely available classes. But how about some concrete steps now too, as to what you can do after CS50 to actually solve problems and write code? Because at the end of the day, you're not going to be handed necessarily these problem set specifications. You're not necessarily going to have a TF or CA to whom you could ask questions with which they themselves are already familiar. You're a bit more on your own in terms of teaching yourself new things. So long as, though, you take advantage of these resources, can you succeed at exactly that. Now you're welcome to continue using something like CS50 IDE for as long as you would like. Your accounts will keep working. And that's meant to be pretty representative of a real-world environment. But of course it's cloud-based, and so if you're on a plane or a train or in some of the dorms or houses where the Wi-Fi isn't so great, might not work so well. And so increasingly, comment after taking one class would be to start installing these kinds of tools on your own Mac or PC. So we'll put these slides up later as well so that you have all of these URLs, but if you'd like, on your Mac or PC, whether it's over Thanksgiving or J-term or beyond, install some command line tools on your Mac or PC. This means having a command line environment on your Mac as suggested here, which actually comes with Mac OS. If you install something for free called Xcode and more, you get a whole suite of command line utilities. In the world of Windows, you can actually install a command line environment that's much better than the built-in command prompt with which you might be familiar, so that it behaves just like Linux. It's essentially running Linux on your own Windows machine. Now git, this is something you guys indirectly use throughout the semester any time you ran Submit 50. But really, all Submit 50 does is run a few different commands, all of them called git. This is a version control software, and it's just one of several different versions, but git probably has the most traction these days. And if you are still in the habit, and even occasionally I'm guilty of this too, at least in the world of writing essays and letters, if you're in the habit of copying a file and then naming it version two, or copying a file and naming it Thursday night, and then Friday morning, and all of these different deltas, that is not a good system, because you're not leveraging the computer to keep track of the differences, especially so that you can rewind back in time. So a program like git actually lets you keep track of all of your changes and you have an Infinite history of all of the work you've ever done. Brian here nicely enough has given a seminar on how to use git and in turn GitHub. On GitHub itself, if you haven't already, you can sign up for free private repositories, which means you can store your coursework and your own work privately, so they're not in public repos, since to date all of your work has been in CS50's account, but you yourselves can start using your own. If you do this, you can just fill out the prompts like this, saying you're students wanting an individual account for free. And then you can install git itself on your own Mac or PC as by following instructions here. But what about actually writing code? I mean theoretically, you can use most any text editing program on your computer, like TextEdit on Mac OS or Notepad on Windows, but these are not very good tools in that they don't have any features that are code-friendly. But it's very easy to install something like this. This is super popular among students these days, Sublime Text, as well as software engineers in the real world. It gives you features like syntax highlighting and nice indentation features, and even auto-complete and more. And so this would be a tool much like the IDE that you can use on your own Mac or PC. An alternative that's also free for use here is Atom. It behaves very similarly, and that too is something you can try as well. If you'd like to go a little deeper and use some older school tools that are very much still in use, myself included, because they're perhaps all the more powerful in that they're much more command-line based, Vim is a very popular one. If you add this autocomplete plug-in, you'll have very similar capabilities even within that environment as well. Now as for final projects, many students end up making web-based applications, maybe borrowing P-set seven or P-set eight's code and then adding and contributing their own when ripping out things that are P-set specific, you can certainly use CS50 IDE to host that website so that friends at the fair and then friends in the houses and dorms can try it out, or friends back home. But of course with these free accounts, they tend to turn off just to save resources after not using it for a few hours or days. You can at least though, in the short term, enable this by going to the Share icon, and CS50 IDE, selecting public for the application, and then any friends who visit a URL that looks like that can actually see your P-set seven, your P-set eight, or soon, your final project If it's web based. But a lot cooler ultimately, and a lot more practical if you want this thing to survive in perpetuity and just run 24/7, would be to use some of these third-party cloud services. Heroku is a very popular service that has you install a little bit of software on your Mac or PC, and then sort of magically thereafter, anytime you run a command, any code you've been working on your Mac or PC gets pushed to the cloud, so to speak, deployed to Heroku servers, and then it can live at your own domain name, either a default one you get for free, but if you want something a little more custom, can you actually buy or for free get your own domain name. Amazon has something called AWS Educate, which you can use for free as well, and there's bunches of other services too. In fact, there's a company called Namecheap, which is not only cheap, it's also free for students if you want to buy your own domain name for your final project or beyond, head to a URL like this one here. And then lastly, GitHub itself, beyond offering version control software, is partnered with bunches of companies that just give free levels of service to students as well. So if you go get this developer pack, so to speak, you'll see even more options that you can use for some amount of time to learn from and actually use compellingly these kinds of services. So what remains and what lies ahead? Well of course, we'll be seeing that the CS50 hackathon, the CS50 fair. More on those in just a moment. But you're also at the point now where you've seen a lot of languages right? Scratch and C, and Python and SQL, and JavaScript. And increasingly if you spend time in this world of CS and programming, and if you Google and read up on Stack Overflow, you're going to find that it's a pretty religious world among some people, where everyone has these strong opinions, sort of correct or incorrect. And so I would encourage you to be as open-minded here on out as to what the right solutions to problems are. It is rarely the case that there is one thing only you should use and realize that a lot of programmers, myself included, will bring to the table biases that you should keep in mind and push back on if you think a problem could be solved differently. And realize too it's all about trade-offs. And this, to kind of paint this picture of the various idiosyncrasies of languages is a wonderful short talk that a fellow gave at a conference a few years ago wherein he pointed out that all languages, the ones especially that he excerpted, have these weird features. And so if you encounter someone in life who's like oh, PHP is bad because of this or Python is bad because of that, well you could probably come up with those kinds of sentences about any language. But what's cool now is that we've seen enough languages and perhaps formed enough opinions that some of the examples you're about to see should on their face be a little nonsensical or weird, and it's more like programming trivia, but hopefully now some 12 weeks later, these examples of programming idiosyncrasies will make sense. Let's take a look. All right, good. You guys know what WAT means? [INTERPOSING VOICES] Exactly, exactly. Let's talk about JavaScript. Does anyone know in JavaScript what array plus array is? Well, let me ask you this first. What should array + array be? AUDIENCE: Empty array. DAVID MALAN: Empty array. I would also accept type error. That is not what array + array is. Wrong. Wrong. Array plus array is empty string. Obviously. I think that's obvious to everyone. Now what would array + object be? This would obviously be TypeError, because those are completely disparate types. Does anyone know what this is? AUDIENCE: Default. DAVID MALAN: No. Close. No, far away. AUDIENCE: Object. DAVID MALAN: It's object. Right, nicely done. Now of course, because this is plus, so you can flip the operands and the same thing comes out. So if we do, what? No that's just an object. If you do object + arrays, you get exactly the same thing, which as you can see you do. And finally, the only one of these that's actually true is, because you know you add arrays, you get empty string, that doesn't make sense. But an object plus an object is actually not a number, technically. So this one's actually right. And exactly, right? Like, what is even going on in this last? I just, I don't even understand what person with a brain in their head would think that any of this is a good idea. OK, OK, enough making fun of languages that suck. Let's talk about JavaScript. If I say array.new 16, or just array 16, I get an array of 16 things which it represents as 16 commas, which is obvious. And if I then join those with a string, then I get the string 16 times. This is actually the only line in this entire presentation that's reasonable. Now if I take that string and then add a 1 to it, it interprets the 1 as, or casts the 1 to a string, and then we get WAT 1 a bunch of times. Fine. Does anyone know what will happen if I subtract 1 from this? I'm assuming no one does. Let me, I'll give you a hint. Does this help? Does anyone know? AUDIENCE: Yes. DAVID MALAN: WAT-man. So programmer humor, just a little taste of it there as well. What comes next? We will wrap a bit early, probably in about 10-- AUDIENCE: [INAUDIBLE] DAVID MALAN: OK. So we'll wrap in about 10 or so minutes. Before then, we want to give you a teaser of what lies ahead and why. So the CS50 hackathon of course, here on campus, is about working on, alongside classmates final projects, and having some 12 hours or so in which to dive into them, not only to actually get something useful and productive done and feel good about it, but also we hope about having a particularly memorable experience among all of the course's staff and all of your classmates. It's not meant to be 12 hours of office hours, but really 12 hours of fun problem-solving with the wonderful support structure of everyone around. Upon arrival, you'll check in like this here. You'll get set up in HBS's Hives across the river, where we had CS50 Puzzle Day. And throughout the evening, well, you work with each other or on your own projects, solving problems ultimately to get to an end of having a project that's either good or better or best as per your proposals. Around 9:00 PM, we'll order in some Felipe's, quite a bit. Around 1:00 AM, we'll order quite a bit of pizza as well. And then throughout the evening, will there be not only photo booth for some souvenir photos. One of CS50's own therapy dogs will be on display to chat with and get to know. Yes, shoutout to Milo here. And then of course, shortly after this, around 2:00, 3:00 AM, such things as this do happen. But if you can make it through the evening, at 5:00 AM, will literally CS50 shuttle show up and take those of you who would like to have a culminating breakfast over down the street to IHOP. And then just a week or so later is the CS50 fair, an opportunity to show off what you've done and what you've learned to all of your classmates here, but also others across campus. In attendance every year some 2,000 students and faculty and staff from across Harvard, some from the surrounding area high schools as well, all of whom are here to see what you have pulled off. So here is a glimpse for instance of last year's CS50 fair. We'll set up laptops and tables and music and food, and really just have you offer an opportunity to delight in what everyone here has pulled off during the semester and hardware demonstrations as well. Also in attendance will be some friends and recruiters and alumni from industry. Pictured here is one of the city's former TFs who actually turned himself into a software engineer having taken CS50 as a senior concentrating in social studies, and then really bootstrapped himself in the few years after graduation to then have a job at Google writing software. And of course you'll receive at the very end, hopefully, this proud statement that you took indeed CS50, and so that will be presented at the CS50 fair as well. In just a little bit we'll adjourn to the pub downstairs, where Aaron and Brian and Maria and the whole team will be waiting to say hello and congratulations with CS50's traditional cupcakes, but before then we thought we'd invite a few of the staff up on stage to participate in an annual CS50 tradition, especially in the spirit of this weekend's competition. But this one not so much Harvard versus Yale, but students versus staff. If we might get four brave volunteers to come on up? OK, I saw one hand over here. Come on up. OK, one hand over here. One hand over here, and a fourth hand over here. Come on up. Thank you so much to our volunteers here. Right there, that's fine, yeah. What's your name? ANDREA: Andrea. DAVID MALAN: Andrea. David. Nice to meet you. Right this way. We'll get some chairs. WILL: Will. DAVID MALAN: Will. Nice to meet you. Right this way. OLIVIA: Olivia. DAVID MALAN: Olivia. Nice to see you. Right this way. And-- HANNAH: Hannah. DAVID MALAN: Hannah. Right this way. We've got four chairs for staff, four chairs for students. All right thank you. Go on, let's put the tablecloths up there too. And Colton, we can spin this around. Let's have the students sit over there on my right. Thank you. And the staff will sit over to their left. Thank you. And here we have, excellent. Excellent. And you want to do some dramatic flair here. All right, so you guys are in charge of that. one. You guys are in charge of that one. Just keep the pen and paper there. Oh, and even better. Yes, let's see. Let's see if we can do a dramatic flourish here. I think we can do better for you guys. Yes. You guys get the better tablecloth. There we go, OK. All right, so you may recall, as part of problem set eight, we asked you a few quiz review questions. Not all of them made the cut into the actual quiz. There was a lot of what is HTTP stand for and what is HTML stand for? But that's OK. We went through the list and culled a few that we'll use here for CS50's annual student v. staff Jeopardy. Because the questions were written in the form of questions and not answers, we'll simply read them as is. We've excerpted a number of categories from which your own classmates wrote questions. We don't have buzzers, but we do have things that squeak, so. We have four of these. So if you just squeak the duck if you'd like to buzz in. Colton will help me adjudicate as to whose hand went up first. And let's go ahead and put a microphone, here microphone here, and before we begin, perhaps some quick hellos of name and dorm or house into the microphones. OLIVIA: Hi. I'm Olivia. I'm a freshman and I'm in Wigg. HANNAH: Hi, I'm Hannah, and I'm a first year at Graduate School of Design. WILL: Hi guys. I'm Will Yao. I live in Grays. ANDREA: Hi. I'm Andrea. I'm a senior in Mather. DAVID MALAN: And let's now meet the staff. ERIN: I'm Erin. ARMAV: I'm Armav. I'm a sophomore in Eliot. THOMAS: I'm Thomas. I'm a senior in Kirkland. MARIA: Maria, senior in Cabot. DAVID MALAN: And so perfect that Maria is up here too, because I went through our archives, and if we look back some four years, there she is as well. When apparently it was fashionable to wear Google Glass around campus. So here we have our Jeopardy board, implemented in HTML. And we have single Jeopardy ahead. We won't run the whole board. Just a few choice examples from each category. Before we began, students won the coin toss, so you guys will get to pick the category and dollar amount. I'll ask the question. Colton will kindly keep track of the score, and we'll see how this turns out. Before we adjourn for cupcakes. What topic would you guys like? OK, Scratch for? AUDIENCE: $200. DAVID MALAN: Scratch for $200. First one to squeak gets the answer. Which puzzle piece starts the program? I think I heard students. ANDREA: The flag one? DAVID MALAN: Yes the one flag clicked. What color is the flag? ANDREA: Green? DAVID MALAN: When green flag clicked is correct, for $200. Very good. Very nice. You're still in control of the board. OLIVIA: Let's take-- memory? [INAUDIBLE] Memory for $400. DAVID MALAN: Memory for $400. Stepping it up. So for Memory, how much memory does a byte have? Also didn't make the quiz. THOMAS: One byte. Eight bits? DAVID MALAN: I'll take eight bits, yes, for $400. Staff are now in control. Nicely done, Thomas. Yes, a byte is a byte. What category would you all like next? Whoa, wait. THOMAS: Algorithms for $400. DAVID MALAN: What for four? THOMAS: Algorithms for $400. DAVID MALAN: Algorithms for $400. So in Algorithms, we have the following question for you. What is the Big O? I heard it over here. WILL: It's used to describe time complexity. DAVID MALAN: Used to describe time complexity. Correct for $400. Wonderful Students are in control and are currently up to $600. Still taking the lead again. What would you like next? STUDENTS: C. DAVID MALAN: C. For $400. C for $400. We're going to go with-- why did we start with C? And there's no answer. Go ahead. I heard you squeak first. WILL: Because if we started with something else, going to C would be terrible. DAVID MALAN: Starting with something else going to C would be terrible. Staff, what do you think? THOMAS: Sure. DAVID MALAN: All right, for $400. That was C for $400. We have time for just one or two more questions here in Single Jeopardy. Students are still in control and really winning now. OLIVIA: C for a thousand. DAVID MALAN: C for a thousand. Oh my goodness. All right, remember to buzz in. What is the ending punctuation to each line of code in order-- I heard I think the staff first. Yes? THOMAS: Semi-colon I hope. DAVID MALAN: It's the staff's turn. Semi-colon for $1,000. Excellent. I think then it's time for us to move to Double Jeopardy here, at which point the dollar amounts increase by a factor of two. We have time for a few questions in this category. Staff are now in control. $1,400 to $1,000. STAFFER: Data structure, $2,000. THOMAS: Data structures for $2,000, please. DAVID MALAN: Data structures. Data structures for $2,000. Data structures for $2,000. Here we go. Data structures for $2,000. How many children does a node have in a binary tree? Oh I heard over here. Yours didn't work. Your duck didn't work. Two is correct. Two is correct for $2,000. Time for one or two more questions. Students are back in control, $3,000 to $1,400. WILL: Python for $2,000. DAVID MALAN: Python for $2,000. Python for $2,000. Python for two. OK, how do you say, for $2,000, else-if? You think Erin? All right, your duck worked this time. ERIN: LF? DAVID MALAN: LF is correct for $2,000. You're now at $3,400. OK, don't have the support of the audience. Time for one more question before Final Jeopardy and cupcakes. What will your category and dollar amount be? MARIA: Let's do HTTP, $2,000. DAVID MALAN: HTTP for $2,000. Really going to pull ahead with this question, potentially. HTTP for $2,000. HTTP for $2,000. OK, when asked for a question about HTTP, your classmate asked us to ask the following question. Laughing my ass off. Just use the cat questions from the test. Asked by-- We'll try another. We'll try another. We are going to go with get coffee. HTTP/1.1. MARIA: What? OLIVIA: Something I'm a teapot? DAVID MALAN: Yes, students. OLIVIA: It's the I'm a teapot error. Okay, sorry, I'll pass it on to you. DAVID MALAN: No that was correct, though. Nicely done. $2,000. So now, this was an old April Fool's joke, where it was introduced as a joke, HTTP 418. So now, we're at time for the Final Jeopardy question where, for this question you have a piece of paper and a pen. The staff have $3,400. The students have $5,000, so there's some strategy here. You're going to first need to decide on a dollar amount knowing only what the category is. The category is going to be web programming. How much would you like to wager on web programming? MARIA: All of it. DAVID MALAN: Oh, I don't think you're supposed to tell me yet. In Jeopardy, yes. And we also need, let me grab just our song here. Stand by one second. And students, if you could write down how much you want to wager, strategically not knowing what the staff is wagering. We need, here we go. ANDREA: I don't know. DAVID MALAN: OK, so you are wagering some amount. And you guys are wagering. OK, so the question is, and you'll have 34 seconds to come up with your answer. This is a real question by one of your classmates. Here we go. The creator of a hybrid language allowing users to meld HTML and Python had what color hair? [MUSIC - "THINK!"] All right, so we're going to take a look first at staff, who were trailing with $3,400. They wagered, turns out, all of it. And answered red hair. The students meanwhile, at $5,000 wagered $1,900 and went with brown. I think we're going to need to have the audience decide whether or not the staff's answer is correct, because according to your classmate who gave us the question, the creator of a hybrid language allowing users to meld HTML and Python had what color hair? The answer is ginger. So congratulations to both staff and to students. Thank you so much for a wonderful semester. Cake is now served downstairs in the pub. We'll see you at the hackathon and fair.