字幕表 動画を再生する 英語字幕をプリント [MUSIC PLAYING] DAVID MALAN: All right. This is CS50. And just eight weeks ago, 2/3 of you had never studied any computer science before. And what we thought we'd begin with today is really a look back of truly how far you've come over just those several weeks. In fact, it was just eight weeks ago when you first started tinkering with Scratch, this graphical programming language by which you could drag and drop puzzle pieces and make the computer do what you want. And then a week later, you might have struggled with just getting Mario to ascend a pyramid by way of hashes that you were printing. Which at the time was perhaps quite non obvious, but it's ever since has just been what? A pair of nested four loops. And then the week after that, you explored cryptography among other fields. And you learned how to encrypt and you decrypted information, like this snippet here. After that, you explored some electoral processes and the implementation of algorithms that you might be familiar with from the real world, but perhaps didn't think about the trade offs in choosing one algorithm or another. And then ultimately, implementing it in code. Just a week later did we transition to filters on Instagram, implementing things like your own sepia filters. So that moving forward, hopefully, you won't take for granted when you click that button on the screen on your phone, you actually know or can presume, or infer, what's going on underneath the hood as it changes from one setting to another. And then, of course, Big Board, where we handed you some 140,000 English words and a really large file. And you had to implement your own spell check, or a dictionary so to speak, with using as little amount of time and as little space as you could, implementing ultimately your own hash table. Thankfully since then, we can now take for granted that those things exist. But you, indeed, built that from scratch. Just a week later, we started handing you large files like this. And of all things, you were able to deduce by writing some Python code that this is lavender's DNA, among others in the class whose files we handed you. And then most recently, or perhaps quite soon, when you learn to apply another language. In this case, SQL. To questions like who has starred in films with Kevin Bacon. And so, a number of tools are now in your toolkit. And again, I would just emphasize that eight weeks ago, 2/3 of you had never done any of that before. So even if it's felt like it has never let up and each week feels all the more challenging than the last, consider the delta. Consider what we promised in the first week of the class. That what ultimately matters in this course is not so much where you end up relative to your classmates, but where you end up relative to yourself when you began. And it is, indeed, those eight weeks ago that you began. And it's today and in the courses final weeks that you will ultimately be able to compare yourself. So in trying to think today about what we hope your own takeaways are from, not only the course, but computer science more generally, I actually pulled up some of my own notes. You might recall from week zero that I mentioned I took this course myself back in 1996 and it happened to be the one that turned me from a government major to a computer science major. And I didn't take many notes at first, it seems in that first class. Now, there were a couple of other pages. And so, I started flipping through these and in fact, this was my second page of notes. And if you focus on what's up here at the top, apparently, one of my first notes to myself that a function, for those unfamiliar today, are instructions that do the work. And indeed, if I looked down further on my notes, arguments we introduced that same first day. It's info that's passed from one function to another to have something done by or performed on it. All right. So that actually maps wonderfully cleanly to what it is we indeed started ourselves doing those eight weeks ago. Just talking about what CS is, problem solving. And a problem is just something that's got input. And the goal, of course, is to produce something with output. And we had to agree from that very first week how we're going to represent these inputs and outputs. And so, we might do it symbolically with letters of the alphabet. We know since then with that we might do it numerically as with decimal digits or below that, we might just use binary, a different base system using only zeros and ones. Or we could even represent that same capital A just using some pattern of light bulbs or switches that you turn on in some order. In fact, if you think back then to these first principles that we introduced those weeks ago, to any of the students now in the audience, what does this say? AUDIENCE: Hi. DAVID MALAN: Hi. So it indeed says hi. Why is that? Well, we just agreed weeks ago on what numbers map to what letters. And so as long as all of the humans in the world agree on that when they're sending emails, or text messages, or the like, our computer systems can all present information that we ultimately understand. Another review question from week zero. What did this say way back when? If you need a hint, it was it was in decimal 128,514. A little louder. AUDIENCE: Emoji. DAVID MALAN: Emoji. This was the face with tears of joy, right? Taking all of the fun out of sending emojis. Anytime you receive or send an emoji, really all you're sending is a pattern of zeros and ones, or worse the number 128,514. But your computer or phone are presenting it to you in a certain way based on that context. All based on just how we humans or those before us decided how to represent this information. But of course, we don't have just those inputs and outputs. There is another piece to the puzzle. And so, I actually looked back at my own third page of notes here and focused on my first line here back in 1996. An algorithm is apparently a precise sequence of steps for getting something done and programming more generally is a process of taking an algorithm and putting it into a language a computer can process. And indeed, that really was the additional puzzle piece we first focused on in week zero. It was what was inside the proverbial black box? The sort of secret sauce that you provide your input to, you get your output from. Those are the algorithms that we've been talking about ever since now, not just in pseudocode or in English. But in C, and in Python, and now SQL. And then in the coming weeks, a few other languages as well. But of course, we used algorithms to solve problems and one problem is and was rather old school. And we thought we'd reflect just a bit and perhaps reinforce that same week zero if by taking a couple of volunteers. Perhaps a student and one of their family members voluntarily or forcibly with them. You have to be comfortable, though, appearing on stage and in turn, the internet in perpetuity is the catch. I see-- OK. I see one volunteer and either mom or dad finding out who is not going to go up. OK [LAUGHTER] Come on up. A round of applause if we could for our volunteers. [APPLAUSE] DAVID MALAN: Come on over this way. And what is your name? DANIELLA: Daniella. DAVID MALAN: Daniella. Nice to meet you. Come on over here. And what is your name? MARIANO: Mariano. DAVID MALAN: Mariano. And your dad, I presume. MARIANO: Yes. DAVID MALAN: All right. Well, so nice to see you both. You'll recall from week zero that one of the first problems we solved was looking up someone in a phone book. Well, here I have a pretty thick yellow pages wherein there's a whole bunch of products and services alphabetized from A to Z. And we can, of course, look up the number for someone in this book. For instance, suppose today we need a plumber. Could we ask Mariano to find us a plumber in this phone book? Flipping through a few pages. A lot of pages. Yeah. OK. All right. And we have a page full of plumbers. And now, could your dad have done better do you think? DANIELLA: Yes. DAVID MALAN: I think so. So would you like to show dad and other parents here what you might have done instead? Oh my goodness. [LAUGHTER] OK. Thank you. [APPLAUSE] [LAUGHTER] DAVID MALAN: And for those wondering, let's continue the algorithm, if you will. What's your next step? [LAUGHTER] Nice. And why are you doing this, though? DANIELLA: So I open halfway and then if it's not on the page and it looks like, for example, if it's n, I know p is afterwards. So I need to get rid of the first half and just look at the second half. DAVID MALAN: Well, need to is a little strong. [LAUGHTER] But you can get rid of-- yes, indeed. So if you keep this process going, halving, and halving, and halving, what should you be left with ultimately? DANIELLA: Just the letter p. DAVID MALAN: Just the letter p. Round of applause would be good for both of our volunteers here. [APPLAUSE] DAVID MALAN: Thank you. A CS50 stress ball for you both. Thank you so much. Oh, thank you. Thanks. So that was one of the first lessons with which we began focusing on algorithms. And the point back then, recall, was to really emphasize the familiar, right? We might not use that particular technology all that much anymore. But it really is fundamentally the same thing that's now in our iPhones and Android devices and the like. It just so happens that we search for things by scrolling with our finger up and down. But consider too, even these days in 2019 when you type into the auto-complete to search for someone by first name or last name, how is your phone finding that information? It's exactly like that. Not quite as physically as that. But most likely for efficiency, your phone is looking roughly in the middle of all of those names then jumping up or down in the blink of an eye in order to find that person for you ever so quickly. And so, all of us might have an intuitive understanding, just like Mariano did, for finding plumbers by jumping to the p section. But then, he came close to the p section, but then started flipping. And I dare say you flipped through far more pages than you ultimately needed to using our more efficient divide and conquer if one time only algorithm instead. So beyond algorithms, I recall that I had just a few other notes. On my last page of notes, I also had this here. That what was apparently important then and no less so now is that in computer science and in turn programming, precision is important and correctness is important. And indeed, one of the things you perhaps gleaned in programming, whether in Scratch or C or Python or SQL over the past few weeks, is that the computers are really unforgiving. They can't just infer like we humans do. And frankly, I'm not sure we would want our computers to just infer sometimes what we mean if the goal is precision and correctness. You need to be ever so precise. So let's see, perhaps, with one more demonstration just how much this one has perhaps sunk in. If we can get perhaps two more volunteers, a student and family member as well.