字幕表 動画を再生する 英語字幕をプリント >> [MUSIC PLAYING] [MUSIC - ROSSINI, "RANZ DES VACHES" FROM WILLIAM TELL] >> [MUSIC - THE ENGLISH BEAT, "MARCH OF THE SWIVEL HEADS"] >> [APPLAUSE AND CHEERING] >> DAVID MALAN: So this is CS50. My name is David Malan. And 73% of you have no prior experience with computer science, contrary to what you might think. So today we thought we would chip away at that lack of familiarity, but also give you a sense of, for those of you with more comfort, which directions you can go this semester. >> So let's start with this. I really have no idea what's inside of a computer, even though, like you, I use it every day. But it's some kind of box, and there's not many inputs into it. Minimally, there's, what? Probably a power cord. >> And indeed with this one ingredient, electricity, we seem to be capable of doing quite a bit these days. But at the end of the day, we have to represent the things that we care about. We have to represent information in some form. And you're probably at least vaguely familiar with the idea by binary or bits somehow or other, computers reduced to zeros and ones. But can we embrace that and at least put a bit of light to that? >> So I have these little desk lamps here. I have an electrical outlet here. And I'm going to propose that inside of my computer is at least one of these things, something capable of being switched on or off. In this case, it's indeed a desk lamp, but at the lower level, it's something called a transistor. >> But in our world, it's a desk lamp, so I'm going to go ahead and plug this into my electricity here. And I claim that using this simple, simple device, this simple switch, I can represent information. For instance, right now, I am representing nothing, right? I'm representing what I'll call 0 or false, the opposite of something actually being present. But if I simply turn this switch, now I've represented a 1. So using this very simple piece of memory, if you will, I can represent information. >> Now unfortunately, my computer can't do all that much. It can only represent two values in the whole world-- 0 or 1. But what's an obvious solution, now, if we want to expand our computer's memory and represent more than just 0 and 1? >> Well, let's grab another such bit. Let's grab another switch, another transistor, however you'd like to think about it. Let me go ahead and plug this into my computer as well. And I'm going to claim, now, that by using a bit more electricity and turning more of these switches on and off, I can represent more such information. >> So right now, this is 1. If I want to now represent 2, I could do this. But typically, convention, as we'll eventually see, will have me do this. So this is 0, this is 1. This would be 2. And not surprisingly, this would be 3. >> So in this way, still, can we count up even further? If I get a third bit, a third switch, what's the highest number I can now count up to from 0? So 7 if I'm starting at 0, right? Because if I turn this light on and actually plug this third and final light into my electrical socket here, then I have the ability to represent any of two values here, two values here, two values here-- and so I can represent 2 times 2 times 2, or eight possible values. And if I start accounting at 0, so that's 0, 1, 2, 3, 4, 5, 6, 7. >> So this binary. It really is as simple as that. And I'd argue that this is actually quite familiar to most everyone in this room. Let me go ahead and open a little text editor here. >> And you might recall from grade school that we had things like the hundreds place, the tens place, and the ones place. And recall that if you had some decimal number, like something random like 123, you would essentially write that out in the form of these three columns. And why is 1, 2, 3 what we know as 123? Well, in the leftmost column, we have one 100 plus two 10s, so that's 120, plus three 1s, so that's 123. >> Now this world that we just illuminated is exactly the same as you've been familiar with for years, except now, our columns aren't powers of 10. They're just powers of 2. So whereas that's the ones place, this is going to be the twos place, this is going to be the fours place. >> And because I am only using the simplest of mechanisms to turn things on and off-- electricity is flowing or electricity is not flowing-- I don't quite have the same expressive range as 0 through nine. We're going to keep it super simple in this world of computers. I only have 0 or 1-- off or on, false or true. >> And so what I'm representing right now is 1, 1, 1, because each of these lights is illuminated. Well, that gives me one 4 plus one 2, so that's 6, plus one 1, and that's 7. And ergo does this sequence of three bits represent the number 7. >> So all this time, inside of your computer, have been any number of transistors, any number of bits. But at the end of the day, we can represent information as simply as that. Now unfortunately, we've only counted up to 7 in CS50 thus far, but hopefully we can do a bit better than that. And indeed we can. >> Suppose that we as humans just arbitrarily decided that we are going to associate numbers like 1 and 2, 3, 4, 5, 6, 7, with specific letters of the alphabet. And for historical reasons, I'm going to start somewhat arbitrarily, but I'm going to say, humans, we are going to decide as a standard, globally, that 65 represents the number the letter A. 66 will represent B. Dot, dot, dot. 90 will represent the letter Z. >> And let's suppose, if we really put some thought into it, we could come up with numbers for exclamation points and lowercase letters, and indeed, other people have done that for us. So now we had bits with which we can represent numbers, numbers with which we can represent letters, and with letters can we now start composing emails and printing characters on the screen. >> So let me invite, if I could, eight brave volunteers-- who don't mind appearing not only on camera but on the internet-- to come up here and represent eight such bits, rather than these three. So how about one, two? How about three? How about four in light blue, five on the end? About someone over here? Six in front, seven in front, and eight in front, as well. >> So I just so happened to come prepared with a whole bunch of slips of paper. And on these pieces of paper are numbers that represent what columns you guys are going to represent. So you will be-- what's your name? >> STUDENT: Anna Leah. >> DAVID MALAN: Anna Leah, you will be the 128s column. You are? >> STUDENT: Chris. >> DAVID MALAN: Chris will be the 64s column. You are? >> STUDENT: Dan. >> DAVID MALAN: Dan will be the 32s column. >> STUDENT: Pramit. >> DAVID MALAN: Pramit will be the 16s column. >> STUDENT: Lillian. >> DAVID MALAN: Lillian will be the 8s. >> STUDENT: Jill. >> DAVID MALAN: Jill will be the 4s column. >> STUDENT: Mary. >> DAVID MALAN: Mary will be the 2s, and? >> STUDENT: David. >> DAVID MALAN: David will be the 1s column. So if you guys could step a little forward so that everyone can see. What you guys don't see is that on the back of these slips of paper is a little cheat sheet that's about to instruct these eight bits to either raise their hand or not raise their hand. If their hand goes up, they're representing a 1. If their hand stays down, they're representing a 0. >> Meanwhile, we the audience should be able to figure out, based on this mapping, what three-letter word these folks are about to spell out. So in just a moment, you're going to read the first line off the back of your cheat sheet, and you're either going to raise or not raise your hand. If you're a 1, you raise, if you're a 0, you stand there awkwardly, just like that. Go. What number, first and foremost, are these guys representing? >> 66. 66, right? We have a 1 in the 64s column, a 1 in the 2s column. That gives me 66, so that appears to be representing B. So you guys have spelled-- OK, that's enough. B. >> So now let's move onto our second letter. Go. Who's quickest at math here? So 79. Again, if we add up all of the columns in which there's a 1, currently, just like we did before with the simplest of examples of 7, we now get the number 79. Which according to our mapping is the letter O. So we're almost there. B, O. And lastly, go. >> What are they representing now? Less consensus. That's just an absolute murmur. Yes, it's in fact 87. Good. >> So if we now map that back up to-- let's start calling our ASCII chart, American Standard Code for Information Interchange. That gives us the letter-- not "bo" but "bow." And that's a perfect cue for you guys to take a bow and head on back. Thank you very much. >> [APPLAUSE] >> DAVID MALAN: You can keep them. Though actually, would anyone like a desk lamp, also? >> [HOOT FROM AUDIENCE] >> DAVID MALAN: Desk lamp? >> [LAUGHTER] >> DAVID MALAN: Really? Desk lamps for everyone? All right. So starting with the very simplest of principles, we've now not only counted up from 0 all the way up to 7, we've assumed that just by throwing more bits or more lights or more transistors at this problem, we can represent bigger and bigger numbers, and ergo, bigger and bigger ranges of alphabets, like English. And just let's take on faith for today that similarly could we start to represent graphics and video and any number of other media with which we're familiar today. >> So this is CS50, and in this class alongside of you are, again, very many classmates who have as little experience as you. And I mention this only because quite often, including as recently as one of the freshman advising events and at last spring's sophomore advising event, we often hear students disclaim when coming up to the CS table, well, I've been thinking about taking this intro class, but I'm not really a computer person. Or, but everyone surely knows more than me. And I put this in the biggest font possible, to convey this message that that's not in fact the case. >> And if you're wondering, should I, in fact, be here? Realize that not only is this course's title Introduction to Computer Science, it is Introduction to Computer Science I. So there is indeed a second such introduction. So you're not, in fact, in the wrong place. And among the goals I have for today are to assuage any such concerns you might have, but also to paint a picture of what's in store for students less and more comfortable alike in this course. >> But first, a word on one of the handouts you have today, among which are a number of FAQs. It's been a vision of ours for some time now to introduce a new grading option into this course-- namely, SAT/UNSAT. Philosophically for me, it is much much, much more important that the students in this class engage with the material, be challenged by the material, and worry far, far less about the mechanics of actual scores and letter grades at semester's end, but truly embrace the course and its material. And really this feels, more generally, for what's interesting to them, to feel challenged and rewarded but without fear of failure. >> And indeed, this too is a recurring theme in this and other introductory courses in other fields, that you have this trepidation when it comes to putting one's toes in unfamiliar waters. I myself, back in 1995, was a freshman. I was very much focused on being a Gov concentrator here. And yet I'd always grown up with a bit of an interest in computer science. I was always curious. >> But back then, even, I had this fear of even stepping foot in CS50, so much so that I didn't even shop it freshman year. And the only reason I put a foot in the door sophomore year was because I was allowed to take it pass/fail. But even pass/fail required that I get up the nerve to make an appointment with Professor Kernehan at the time, bring this big sheet of paper, and ask him for his signature and his permission to explore these unfamiliar waters.