1 00:00:00,000 --> 00:00:03,479 [MUSIC PLAYING] 2 00:00:03,479 --> 00:00:49,790 3 00:00:49,790 --> 00:00:52,370 DAVID MALAN: Well, so nice to see so many of you. 4 00:00:52,370 --> 00:00:55,100 In healthier times, we would, of course, all be on campus. 5 00:00:55,100 --> 00:00:57,800 But so glad you could tune in from all over the world this way. 6 00:00:57,800 --> 00:00:58,850 My name is David Malan. 7 00:00:58,850 --> 00:01:01,490 I teach a course called CS50, or Computer Science 50 8 00:01:01,490 --> 00:01:04,730 at Harvard, which is our introduction to the intellectual enterprises 9 00:01:04,730 --> 00:01:07,400 of computer science, and the art of programming. 10 00:01:07,400 --> 00:01:09,950 And by way of today's talk, we thought we would give you 11 00:01:09,950 --> 00:01:14,090 a sense of exactly what CS50 is about, what computer science is about, 12 00:01:14,090 --> 00:01:17,400 but also giving you a sense of some of the campus itself. 13 00:01:17,400 --> 00:01:19,760 Indeed, had these been healthier times, we 14 00:01:19,760 --> 00:01:21,725 were hoping to convene in a space like this. 15 00:01:21,725 --> 00:01:23,900 This is the American Repertory Theater, which is 16 00:01:23,900 --> 00:01:25,700 one of the artistic spaces on campus. 17 00:01:25,700 --> 00:01:28,670 Where, because of COVID this past year, we, CS50, 18 00:01:28,670 --> 00:01:30,770 actually had an opportunity to collaborate 19 00:01:30,770 --> 00:01:34,550 with the artists that run that theater and to teach CS50's lectures 20 00:01:34,550 --> 00:01:36,185 from that particular space. 21 00:01:36,185 --> 00:01:38,060 If you zoom in here, you'll see for instance, 22 00:01:38,060 --> 00:01:40,070 we tucked a green screen off to the side so 23 00:01:40,070 --> 00:01:42,980 that we could display code and other computer sciencey-type things 24 00:01:42,980 --> 00:01:43,820 on the stage. 25 00:01:43,820 --> 00:01:46,010 But what I saw this past fall, of curious, 26 00:01:46,010 --> 00:01:47,420 was a little something like this. 27 00:01:47,420 --> 00:01:49,640 Unfortunately, an empty theater with no students 28 00:01:49,640 --> 00:01:53,600 present, but a whole bunch of TV screens on which we could see tiles of zoom 29 00:01:53,600 --> 00:01:57,202 like we're doing now so as to interact in much the same way. 30 00:01:57,202 --> 00:01:58,910 So I'm not sure just yet what this coming 31 00:01:58,910 --> 00:02:01,190 fall will be like, but happy to say that we've 32 00:02:01,190 --> 00:02:04,640 got models that work both ways indeed. 33 00:02:04,640 --> 00:02:07,040 Just as a heads up as part of today's presentation, 34 00:02:07,040 --> 00:02:09,740 if you have access to a piece of paper and a pen or pencil, do 35 00:02:09,740 --> 00:02:15,290 try to grab that at some point soon in case we might reach for it later. 36 00:02:15,290 --> 00:02:19,940 But welcome to CS50 and in turn, a taste there of. 37 00:02:19,940 --> 00:02:24,027 I thought I'd begin by zooming out as to where we actually are on campus, 38 00:02:24,027 --> 00:02:26,360 and give you a tour of just some of the first few places 39 00:02:26,360 --> 00:02:28,160 that I myself visited back in the day. 40 00:02:28,160 --> 00:02:30,860 Indeed, some 25 years ago, I had decided-- 41 00:02:30,860 --> 00:02:34,520 perhaps like you-- to go to Cambridge, Massachusetts and enroll 42 00:02:34,520 --> 00:02:36,060 in Harvard as a first year. 43 00:02:36,060 --> 00:02:41,180 And at the time, I found myself gravitating toward fields 44 00:02:41,180 --> 00:02:43,140 quite different from computer science. 45 00:02:43,140 --> 00:02:45,380 In fact, let me go ahead and zoom in here. 46 00:02:45,380 --> 00:02:48,740 Pictured here, for instance, was one of my first locations 47 00:02:48,740 --> 00:02:51,710 on Earth, and in turn, Cambridge, Massachusetts. 48 00:02:51,710 --> 00:02:53,720 I found myself assigned to Matthew's Hall, which 49 00:02:53,720 --> 00:02:56,245 is one of the dormitories in Harvard Yard there. 50 00:02:56,245 --> 00:02:58,370 So using Google Earth here to give you a bird's eye 51 00:02:58,370 --> 00:03:00,230 view of what that dorm room is. 52 00:03:00,230 --> 00:03:02,300 Can't quite see it, but one of the window 53 00:03:02,300 --> 00:03:05,270 seats here in the front of the building happened 54 00:03:05,270 --> 00:03:06,920 to be my own room with my roommates. 55 00:03:06,920 --> 00:03:10,280 And in fact, our claim to fame was that Matt Damon, the actor, 56 00:03:10,280 --> 00:03:12,840 actually lived in our room three years prior. 57 00:03:12,840 --> 00:03:18,260 So never actually met him, but listed on the list of past residents 58 00:03:18,260 --> 00:03:20,450 when we moved in was indeed, his name. 59 00:03:20,450 --> 00:03:22,680 But at the time, this first year of college, 60 00:03:22,680 --> 00:03:25,280 I found myself gravitating toward more familiar fields. 61 00:03:25,280 --> 00:03:28,370 In high school, for instance, I really liked history class. 62 00:03:28,370 --> 00:03:30,448 I really loved a class on constitutional law. 63 00:03:30,448 --> 00:03:32,240 And so when I got to Harvard and was trying 64 00:03:32,240 --> 00:03:34,730 to choose among all of the available concentrations, 65 00:03:34,730 --> 00:03:38,240 I started gravitating initially toward what I was most comfortable with. 66 00:03:38,240 --> 00:03:40,880 And I did nearly half of the government concentration 67 00:03:40,880 --> 00:03:43,340 it seems in retrospect, until finally about halfway 68 00:03:43,340 --> 00:03:45,980 through college did I discover something a little different. 69 00:03:45,980 --> 00:03:48,560 In fact, sophomore year, my second year on campus, 70 00:03:48,560 --> 00:03:51,358 I ended up in one of the upper class houses called Mather House. 71 00:03:51,358 --> 00:03:53,150 Not nearly as pretty as some of the others, 72 00:03:53,150 --> 00:03:56,990 but amazing views here of both the river and the rest of Cambridge. 73 00:03:56,990 --> 00:03:59,120 And it was indeed my sophomore fall that I finally 74 00:03:59,120 --> 00:04:03,770 got up the nerve to shop, that is to attend briefly, a class called CS50. 75 00:04:03,770 --> 00:04:06,540 It was being taught by a visiting professor at the time. 76 00:04:06,540 --> 00:04:11,555 And I found myself, long story short, finally excited about learning. 77 00:04:11,555 --> 00:04:13,430 And finally excited about a particular field. 78 00:04:13,430 --> 00:04:14,180 In fact, for what? 79 00:04:14,180 --> 00:04:16,760 19 years at that point, if homework was something that I did, 80 00:04:16,760 --> 00:04:19,579 I sort of felt compelled to do well as best I could. 81 00:04:19,579 --> 00:04:21,769 But it wasn't something I was particularly ever 82 00:04:21,769 --> 00:04:24,020 passionate about until CS. 83 00:04:24,020 --> 00:04:26,150 And for the first time ever, literally, did 84 00:04:26,150 --> 00:04:28,700 homework suddenly finally become fun. 85 00:04:28,700 --> 00:04:32,270 At the time, we were actually across campus over here in Harvard Science 86 00:04:32,270 --> 00:04:35,120 Center when the course met in one of the lecture halls 87 00:04:35,120 --> 00:04:38,150 there that you'll perhaps see before long on campus. 88 00:04:38,150 --> 00:04:41,870 Nowadays though, some years later, did I take the helm of that same course 89 00:04:41,870 --> 00:04:44,750 after finding my way, after some trepidation, 90 00:04:44,750 --> 00:04:46,320 to computer science itself. 91 00:04:46,320 --> 00:04:49,430 And so the home of CS50 nowadays during healthy times 92 00:04:49,430 --> 00:04:52,250 is this building here, which you might recognize as Memorial Hall. 93 00:04:52,250 --> 00:04:54,560 Which is one of the largest, most beautiful spaces on campus. 94 00:04:54,560 --> 00:04:56,690 Where Annenberg Hall, is where the first years eat, 95 00:04:56,690 --> 00:05:01,410 as well as Sanders Theater where we, CS50, spend quite a bit of time. 96 00:05:01,410 --> 00:05:03,350 So we'll share out a URL of that little tour 97 00:05:03,350 --> 00:05:05,017 thereafter if you'd like to get a sense. 98 00:05:05,017 --> 00:05:07,220 But for now, I thought we'd go inside as well, 99 00:05:07,220 --> 00:05:10,250 if you're curious to see what Sanders itself looks like. 100 00:05:10,250 --> 00:05:12,710 Indeed, were these healthier times, most all of us 101 00:05:12,710 --> 00:05:16,490 would ideally be sitting in this space here looking up at this stage and all 102 00:05:16,490 --> 00:05:17,570 of the woodwork there. 103 00:05:17,570 --> 00:05:19,760 And if I spin us around here in this 3D view, 104 00:05:19,760 --> 00:05:24,210 you'd see seats for some thousand first years, sophomores, juniors, seniors, 105 00:05:24,210 --> 00:05:25,280 and parents alike. 106 00:05:25,280 --> 00:05:27,230 So hopefully before long, you'll get a chance 107 00:05:27,230 --> 00:05:29,630 to actually visit some of those spaces in person. 108 00:05:29,630 --> 00:05:35,210 But there is where we introduce students nowadays ultimately to computer science 109 00:05:35,210 --> 00:05:36,410 and problem-solving. 110 00:05:36,410 --> 00:05:39,650 Indeed, if we were to distill all of computer science, all of CS50 111 00:05:39,650 --> 00:05:42,950 to just one picture, I would propose we consider something like this. 112 00:05:42,950 --> 00:05:46,190 Computer science at the end of the day is all about problem-solving. 113 00:05:46,190 --> 00:05:48,640 And whereas in high school and prior, perhaps, 114 00:05:48,640 --> 00:05:51,985 if you've done any computer science whatsoever or know people who have, 115 00:05:51,985 --> 00:05:54,430 you might view it really as programming alone. 116 00:05:54,430 --> 00:05:56,660 And programming for many people is a big part of it, 117 00:05:56,660 --> 00:05:59,110 but it really is just a tool in one's toolkit. 118 00:05:59,110 --> 00:06:01,930 At the end of the day, what was so exciting for me about computer 119 00:06:01,930 --> 00:06:06,760 science was the ability to get better at and to solve actual real world 120 00:06:06,760 --> 00:06:07,262 problems. 121 00:06:07,262 --> 00:06:08,470 And what does a problem have? 122 00:06:08,470 --> 00:06:10,037 It has some form of input. 123 00:06:10,037 --> 00:06:11,620 That is the problem you want to solve. 124 00:06:11,620 --> 00:06:15,670 The goal of which then is to have some form of output, the solution there too. 125 00:06:15,670 --> 00:06:18,970 But before we can solve any problems-- and even think about these inputs 126 00:06:18,970 --> 00:06:19,960 and outputs-- 127 00:06:19,960 --> 00:06:23,142 we have to consider for a moment how we can represent information. 128 00:06:23,142 --> 00:06:25,600 For instance, there's a whole bunch of people in this room. 129 00:06:25,600 --> 00:06:29,440 And of course, Zoom is doing the attendance for us by counting everyone. 130 00:06:29,440 --> 00:06:31,450 But how is Zoom doing that underneath the hood? 131 00:06:31,450 --> 00:06:33,640 Or if we were in person in Sanders, how could we 132 00:06:33,640 --> 00:06:36,160 go about counting everyone in the room? 133 00:06:36,160 --> 00:06:37,220 A problem to be solved. 134 00:06:37,220 --> 00:06:38,742 How many people are actually here? 135 00:06:38,742 --> 00:06:40,450 Well, we could certainly do it old school 136 00:06:40,450 --> 00:06:45,010 and just sort of count on one hand and 1, 2, 3, 4, 5, and then maybe 137 00:06:45,010 --> 00:06:47,450 use another hand as needed and so forth. 138 00:06:47,450 --> 00:06:51,460 And so that's certainly doesn't scale very well, because let 139 00:06:51,460 --> 00:06:53,410 me ask an obvious question. 140 00:06:53,410 --> 00:06:56,140 How high can you count on a hand? 141 00:06:56,140 --> 00:06:59,050 Feel free to chime in on the chats, not a trick question. 142 00:06:59,050 --> 00:07:02,812 But the most obvious answer here, how high can you count on a hand? 143 00:07:02,812 --> 00:07:03,520 One hand, though. 144 00:07:03,520 --> 00:07:04,060 One hand. 145 00:07:04,060 --> 00:07:05,395 So started high there. 146 00:07:05,395 --> 00:07:08,020 But yeah, all the fives that are coming in and all of the Troys 147 00:07:08,020 --> 00:07:09,310 who are responding five still. 148 00:07:09,310 --> 00:07:12,790 Indeed, you can presumably only count up as high as five. 149 00:07:12,790 --> 00:07:14,990 OK, so now we're getting a little more creative. 150 00:07:14,990 --> 00:07:16,900 But indeed, we're going off track there. 151 00:07:16,900 --> 00:07:18,640 Let me stipulate that it is indeed five. 152 00:07:18,640 --> 00:07:19,140 Why? 153 00:07:19,140 --> 00:07:20,980 On one hand I've got five fingers. 154 00:07:20,980 --> 00:07:24,010 But I bet we could count higher than that, because at the moment-- 155 00:07:24,010 --> 00:07:27,160 I went ahead in advance here and wrote on my fingers-- 156 00:07:27,160 --> 00:07:29,170 we're sort of treating each of my fingers 157 00:07:29,170 --> 00:07:32,860 here as representing a single person, or just the number one. 158 00:07:32,860 --> 00:07:35,830 And so by putting up one finger and the number 1 or 2 159 00:07:35,830 --> 00:07:39,500 I'm keeping track of 1, 2, 3, 4, 5 people. 160 00:07:39,500 --> 00:07:42,430 But what if instead, we got a little more creative as humans 161 00:07:42,430 --> 00:07:45,700 and maybe assigned different weights to our fingers? 162 00:07:45,700 --> 00:07:48,250 And so here too, I drew lefty on my other hand. 163 00:07:48,250 --> 00:07:52,570 And what if instead, my thumb represented still the number 1. 164 00:07:52,570 --> 00:07:56,290 But maybe my index finger here could represent the number 2. 165 00:07:56,290 --> 00:07:58,840 My middle finger could represent the number 4. 166 00:07:58,840 --> 00:08:02,383 Ring finger number 8, and pinky could represent 16. 167 00:08:02,383 --> 00:08:04,300 And there's indeed a pattern to those numbers, 168 00:08:04,300 --> 00:08:08,020 but if I do weight my fingers more differently, 169 00:08:08,020 --> 00:08:10,570 how high now might I be able to count? 170 00:08:10,570 --> 00:08:14,630 And I saw a couple of you actually chimed with this answer already. 171 00:08:14,630 --> 00:08:19,150 But if you haven't, consider how high could I now count on this human hand. 172 00:08:19,150 --> 00:08:21,400 The only difference being that you and I might 173 00:08:21,400 --> 00:08:24,250 agree in advance to represent information by assigning 174 00:08:24,250 --> 00:08:26,560 different weights to these fingers. 175 00:08:26,560 --> 00:08:29,990 So yeah, I'm seeing a whole bunch of 31s now fly across the screen. 176 00:08:29,990 --> 00:08:33,549 And if that's not obvious to you-- that wasn't to me early on-- 177 00:08:33,549 --> 00:08:36,909 but consider that here's my fist closed, here's the number 0. 178 00:08:36,909 --> 00:08:39,549 If I want to now count up the number 1, I'll raise my thumb, 179 00:08:39,549 --> 00:08:41,020 and that's indeed the number 1. 180 00:08:41,020 --> 00:08:43,270 If I want to now count to 2, I'm not just 181 00:08:43,270 --> 00:08:45,680 going to put up a second finger like before. 182 00:08:45,680 --> 00:08:49,930 I'm going to use a finger that's got a slightly different weight, my 2 finger. 183 00:08:49,930 --> 00:08:52,000 And so I only have one finger up at this point. 184 00:08:52,000 --> 00:08:55,630 If I want to represent the number 3, I can, of course, now put two fingers up, 185 00:08:55,630 --> 00:08:58,960 because one's weight is 1, the other is 2, giving me 3. 186 00:08:58,960 --> 00:09:02,200 If I now want to count as high as 4, I can somewhat offensively put up 187 00:09:02,200 --> 00:09:03,220 my middle finger. 188 00:09:03,220 --> 00:09:07,990 But then let's quickly count up to 5, which now uses my 4 and my 1 finger. 189 00:09:07,990 --> 00:09:11,320 If I want to go to 6, it's now the 4 and the 2. 190 00:09:11,320 --> 00:09:15,210 And then if I put up my thumb again, it's 1, 2, 4, which gives me 7. 191 00:09:15,210 --> 00:09:16,960 And then it's a little painful on my hand, 192 00:09:16,960 --> 00:09:20,230 but my ring finger would now allow me to count to 8. 193 00:09:20,230 --> 00:09:24,220 And I'll stipulate that more nimble person could count all the way up 194 00:09:24,220 --> 00:09:28,780 indeed to 31, because ultimately, that's how many permutations 195 00:09:28,780 --> 00:09:31,960 you can actually have on your human hand if you 196 00:09:31,960 --> 00:09:34,540 have five values available to you. 197 00:09:34,540 --> 00:09:37,750 Five digits-- literally, no pun intended-- 198 00:09:37,750 --> 00:09:41,110 whereby each of those fingers can either be down or up. 199 00:09:41,110 --> 00:09:44,740 And it turns out that this very simple idea on the human hand 200 00:09:44,740 --> 00:09:47,390 maps exactly to what computers nowadays do. 201 00:09:47,390 --> 00:09:50,230 You probably have a sense-- even if you're not a computer person, 202 00:09:50,230 --> 00:09:53,410 have never studied CS or done any programming-- you've probably 203 00:09:53,410 --> 00:09:56,200 at least heard that computers use the so-called binary system. 204 00:09:56,200 --> 00:09:58,060 0s and 1s in some form. 205 00:09:58,060 --> 00:10:01,750 Which is to say that they're really good at representing two values. 206 00:10:01,750 --> 00:10:05,410 For instance, this could be the number 0 if the computer, 207 00:10:05,410 --> 00:10:08,080 the digital equivalent, is sort of holding up no fingers. 208 00:10:08,080 --> 00:10:11,440 And if a computer wants to represent a second value, 1, 209 00:10:11,440 --> 00:10:14,440 the computer might do the equivalent of holding up a single human hand. 210 00:10:14,440 --> 00:10:17,530 Either my finger is down or my finger is up. 211 00:10:17,530 --> 00:10:20,410 And this is actually a very useful primitive. 212 00:10:20,410 --> 00:10:22,690 Because at the end of the day, what's the only input 213 00:10:22,690 --> 00:10:26,830 physically to your computer, your laptop, your desktop or your phone? 214 00:10:26,830 --> 00:10:28,837 It's some form of electricity, right? 215 00:10:28,837 --> 00:10:30,670 At the end of the day or throughout the day, 216 00:10:30,670 --> 00:10:34,150 you presumably plug your device into a physical outlet 217 00:10:34,150 --> 00:10:38,200 so that you get electricity, electrons, some kind of flow of electricity. 218 00:10:38,200 --> 00:10:42,280 But that electricity-- even if you have no recollection or no studies in how 219 00:10:42,280 --> 00:10:45,790 electricity works-- it's either there or it isn't. 220 00:10:45,790 --> 00:10:49,240 Which is to say, in the physical world, just like a human hand-- 221 00:10:49,240 --> 00:10:52,960 if you have a way of representing at least two different states, two 222 00:10:52,960 --> 00:10:57,250 different conditions, down or up or off or on, 223 00:10:57,250 --> 00:11:01,660 you can actually now speak or represent what we would call binary. 224 00:11:01,660 --> 00:11:06,010 Bi meaning two, binary just being distinct from decimal, for instance. 225 00:11:06,010 --> 00:11:08,340 Dec meaning 10, which is the number 0 through 9 226 00:11:08,340 --> 00:11:10,090 that you and I typically use in the world. 227 00:11:10,090 --> 00:11:13,360 Computers indeed only use binary, 0s and 1s. 228 00:11:13,360 --> 00:11:16,300 And what is inside each of our computers and phones these days, 229 00:11:16,300 --> 00:11:19,870 essentially, is a whole bunch of tiny little light switches. 230 00:11:19,870 --> 00:11:22,270 Or transistors if you will. 231 00:11:22,270 --> 00:11:24,010 Millions of tiny little switches that can 232 00:11:24,010 --> 00:11:28,960 be on or off that allow the computer to either remember that the finger is down 233 00:11:28,960 --> 00:11:30,040 or the finger is up. 234 00:11:30,040 --> 00:11:32,830 That the electricity is off or the electricity is on. 235 00:11:32,830 --> 00:11:37,360 These little switches can be toggled up and down so that if it's off, 236 00:11:37,360 --> 00:11:38,380 it might look like this. 237 00:11:38,380 --> 00:11:40,370 If the switch is on, it might look like this. 238 00:11:40,370 --> 00:11:42,370 But we don't really need pictures at this point, 239 00:11:42,370 --> 00:11:44,050 we just need two different digits-- 240 00:11:44,050 --> 00:11:45,880 not even fingers or light bulbs-- 241 00:11:45,880 --> 00:11:50,080 here comes the so-called 0s and 1s the computer speak. 242 00:11:50,080 --> 00:11:53,170 They don't need 2 through 9, they only need 0 and 1. 243 00:11:53,170 --> 00:11:56,080 Because at the end of the day, they're representing information 244 00:11:56,080 --> 00:11:59,600 by just toggling all of these little switches and little patterns. 245 00:11:59,600 --> 00:12:04,810 Of course, this is problematic if you only have a single binary digit. 246 00:12:04,810 --> 00:12:07,360 A single bit, if you will. 247 00:12:07,360 --> 00:12:08,380 0 or 1. 248 00:12:08,380 --> 00:12:10,900 Because of course, you can count as high as 1 only, 249 00:12:10,900 --> 00:12:16,510 but how do you still count to 2 or 3 or 7 or 15 or 31 or even a million? 250 00:12:16,510 --> 00:12:19,780 Well, it just seems that you need more bits, more 0s and 1s. 251 00:12:19,780 --> 00:12:21,850 And here's where things actually get familiar. 252 00:12:21,850 --> 00:12:24,730 And even this is something where the light bulb proverbially went off 253 00:12:24,730 --> 00:12:25,750 for me years ago. 254 00:12:25,750 --> 00:12:30,670 Let's consider something ordinary like this 123, on the screen here. 255 00:12:30,670 --> 00:12:32,890 This is the decimal number 123. 256 00:12:32,890 --> 00:12:33,820 This is not binary. 257 00:12:33,820 --> 00:12:37,150 This is sort of middle school math, where we've got a number 123. 258 00:12:37,150 --> 00:12:38,740 But why is it that value? 259 00:12:38,740 --> 00:12:42,040 Technically, all I've got on the screen right now is three symbols. 260 00:12:42,040 --> 00:12:45,100 Sort of a straight line, a curly one, and then a doubly curly one. 261 00:12:45,100 --> 00:12:46,900 The 1, 2, and 3, respectively. 262 00:12:46,900 --> 00:12:50,560 But you and I instinctively assign meaning to these symbols, 263 00:12:50,560 --> 00:12:52,870 because we've sort of grown up with this methodology. 264 00:12:52,870 --> 00:12:55,810 You know that the 3 is in the so-called ones place, 265 00:12:55,810 --> 00:12:59,470 and the 2 is in the so-called tens place and the 1 266 00:12:59,470 --> 00:13:01,760 is in the so-called one hundreds place. 267 00:13:01,760 --> 00:13:06,910 So how do we get from this pattern of symbols of 1, 2, 3 to 123? 268 00:13:06,910 --> 00:13:10,900 Well, you and I do a bit of quick, rapid, instant mental math. 269 00:13:10,900 --> 00:13:15,010 It's the same thing as 100 times 1 plus 10 times 270 00:13:15,010 --> 00:13:19,630 2 plus 1 times 3, which of course gives us 100 plus 20 plus 3, 271 00:13:19,630 --> 00:13:23,455 or the number you and I know mathematically is 123. 272 00:13:23,455 --> 00:13:26,080 Well, it turns out computers-- even if again, you're not really 273 00:13:26,080 --> 00:13:28,270 a computer person and wouldn't otherwise grok 274 00:13:28,270 --> 00:13:31,210 how they are working underneath the hood-- it's actually 275 00:13:31,210 --> 00:13:32,290 the exact same way. 276 00:13:32,290 --> 00:13:35,950 Let me generalize these digits as just the hash symbols for a moment 277 00:13:35,950 --> 00:13:38,890 to make clear that in the world of decimal, in our human world, 278 00:13:38,890 --> 00:13:40,180 we give these columns meaning. 279 00:13:40,180 --> 00:13:44,180 One, tens place, hundreds place, thousands place, and so forth. 280 00:13:44,180 --> 00:13:47,120 But the reason for that is because of a bit of simple math. 281 00:13:47,120 --> 00:13:51,560 These are technically 10 to the 0 power, 10 to the first, 10 to the second, 282 00:13:51,560 --> 00:13:53,080 and so forth. 283 00:13:53,080 --> 00:13:55,900 In binary, where you only have two digits 284 00:13:55,900 --> 00:13:59,350 at your disposal, 0 and 1 instead of 0 through 9, 285 00:13:59,350 --> 00:14:01,180 the methodology is exactly the same. 286 00:14:01,180 --> 00:14:03,080 But what's going on inside of a computer-- 287 00:14:03,080 --> 00:14:08,020 so as to represent not just 0 not just 1 but any number bigger than that-- 288 00:14:08,020 --> 00:14:10,810 is we actually use powers of 2 instead of 10. 289 00:14:10,810 --> 00:14:14,890 So it's 2 to the 0, 2 the 1, 2 to the 2, otherwise known, of course, as ones 290 00:14:14,890 --> 00:14:17,770 place, twos place, and fours place. 291 00:14:17,770 --> 00:14:20,890 And that hopefully looks a bit familiar, because that's exactly what I 292 00:14:20,890 --> 00:14:22,510 started writing on my fingers before. 293 00:14:22,510 --> 00:14:26,660 The ones place, twos place, fours, eights, 16, and so forth. 294 00:14:26,660 --> 00:14:29,630 So once you have that paradigm in place here, for instance, 295 00:14:29,630 --> 00:14:33,640 is how a computer would represent the number you and I know as 0. 296 00:14:33,640 --> 00:14:35,860 It happens to have three digits here, but of course, 297 00:14:35,860 --> 00:14:39,730 in math when you write 0s to the left of a number it doesn't change the meaning. 298 00:14:39,730 --> 00:14:42,910 But if a computer wanted to store the number 0 for any reason-- 299 00:14:42,910 --> 00:14:46,180 because it's in your phone number, because it's a mathematical part 300 00:14:46,180 --> 00:14:47,560 of a formula-- 301 00:14:47,560 --> 00:14:51,100 a computer would just toggle three switches off, thereby 302 00:14:51,100 --> 00:14:54,290 storing no electricity, essentially, in those three locations. 303 00:14:54,290 --> 00:14:56,380 So the ones place, the twos place, the fours place 304 00:14:56,380 --> 00:15:00,970 have 0 under them, so it's just the number we know as 0. 305 00:15:00,970 --> 00:15:04,930 A computer, by contrast, if still using three digits or three bits 306 00:15:04,930 --> 00:15:07,120 to represent the number you and I know as 1, 307 00:15:07,120 --> 00:15:09,410 would just put up a single finger, so to speak. 308 00:15:09,410 --> 00:15:11,860 Or represent it digitally as 001. 309 00:15:11,860 --> 00:15:15,340 If we want to represent the number we know as 2, it's now 010, 310 00:15:15,340 --> 00:15:18,010 which is exactly why I held up one finger before. 311 00:15:18,010 --> 00:15:22,720 If you want to represent the number 3, it's now 011, or two fingers up, 312 00:15:22,720 --> 00:15:23,930 like I did before. 313 00:15:23,930 --> 00:15:31,870 And if we keep going, 4 would be 100, 5 would be 101, 6 would be 110, 314 00:15:31,870 --> 00:15:35,470 and 7, ultimately, would be 111. 315 00:15:35,470 --> 00:15:39,400 So that's in essence, what a computer does to represent information. 316 00:15:39,400 --> 00:15:42,588 And if all of us agree on how to represent information in binary, 317 00:15:42,588 --> 00:15:45,130 now, all of our computers can intercommunicate, and with them 318 00:15:45,130 --> 00:15:46,265 can we solve problems. 319 00:15:46,265 --> 00:15:47,890 And what was one of the first problems? 320 00:15:47,890 --> 00:15:50,700 Well, not just to do math and perform calculations and the like, 321 00:15:50,700 --> 00:15:52,670 but to actually represent information. 322 00:15:52,670 --> 00:15:55,380 Letters of the alphabet, the English alphabet for instance. 323 00:15:55,380 --> 00:15:57,470 If you were to receive a text message right now 324 00:15:57,470 --> 00:16:02,510 or an the email with simply the message H-I in all caps from someone, 325 00:16:02,510 --> 00:16:05,990 technically what you've received is some kind of binary message. 326 00:16:05,990 --> 00:16:09,710 Some kind of pattern of 0s and 1s that if we really look underneath the hood, 327 00:16:09,710 --> 00:16:11,430 would look like this. 328 00:16:11,430 --> 00:16:14,930 In other words, if you receive a pattern of electricity, so to speak, 329 00:16:14,930 --> 00:16:19,460 that represents off, on, off, off, on, off, off, off and so forth, 330 00:16:19,460 --> 00:16:23,720 what you've just received is an H followed by the letter I. 331 00:16:23,720 --> 00:16:25,637 This is true of these things nowadays, emojis, 332 00:16:25,637 --> 00:16:28,637 that you are probably in the habit of sending and receiving quite a bit. 333 00:16:28,637 --> 00:16:31,190 Even though those look like pictures, underneath the hood 334 00:16:31,190 --> 00:16:33,800 they are represented with a pattern of 0s and 1s 335 00:16:33,800 --> 00:16:37,370 that all of our Macs, PCs, iPhones, Android phones and other devices 336 00:16:37,370 --> 00:16:39,860 nowadays are preprogrammed to understand. 337 00:16:39,860 --> 00:16:42,350 And as soon as they see that recognized pattern, 338 00:16:42,350 --> 00:16:46,642 they present that image for you on the screen. 339 00:16:46,642 --> 00:16:49,100 So this is to say-- and we could keep going down this road, 340 00:16:49,100 --> 00:16:50,900 and we do in CS50 itself-- 341 00:16:50,900 --> 00:16:52,970 how you represent not just numbers and letters, 342 00:16:52,970 --> 00:16:57,140 but images and sounds and videos and all of the medium with which we're familiar 343 00:16:57,140 --> 00:16:57,710 today. 344 00:16:57,710 --> 00:16:59,835 But I think at this point, we can stipulate that we 345 00:16:59,835 --> 00:17:01,730 have a way of representing information. 346 00:17:01,730 --> 00:17:04,430 The so-called binary system, with 0s and 1s 347 00:17:04,430 --> 00:17:06,109 that's just convenient for computers. 348 00:17:06,109 --> 00:17:10,520 Because again, there's either electricity there or there isn't. 349 00:17:10,520 --> 00:17:12,770 So there's one last piece of this puzzle when 350 00:17:12,770 --> 00:17:15,349 it comes to coming up with this mental model for what 351 00:17:15,349 --> 00:17:17,329 it means to study computer science. 352 00:17:17,329 --> 00:17:20,750 And to ultimately solve problems, we need these things called algorithms. 353 00:17:20,750 --> 00:17:23,089 Another term that you've perhaps heard or used even-- 354 00:17:23,089 --> 00:17:25,460 if you've not studied CS or programming itself-- 355 00:17:25,460 --> 00:17:29,418 but an algorithm is just step by step instructions for solving some problem. 356 00:17:29,418 --> 00:17:30,710 And what might that problem be? 357 00:17:30,710 --> 00:17:32,840 Well, nowadays, all of you have some form 358 00:17:32,840 --> 00:17:35,150 of contacts on your iPhone or your Android device. 359 00:17:35,150 --> 00:17:37,088 And you might have a few friends as favorites, 360 00:17:37,088 --> 00:17:40,130 but sometimes you might use autocomplete and start typing someone's name. 361 00:17:40,130 --> 00:17:43,460 And then boom, that person's name and number hopefully come up. 362 00:17:43,460 --> 00:17:47,240 That process might take longer though if you've got lots of friends and family, 363 00:17:47,240 --> 00:17:49,280 because the list is just much longer. 364 00:17:49,280 --> 00:17:52,190 Now naively, your iPhone or Android phone 365 00:17:52,190 --> 00:17:56,630 could just look for whoever it is you're searching for from top to bottom, 366 00:17:56,630 --> 00:17:57,878 looking is this the person? 367 00:17:57,878 --> 00:17:58,670 Is this the person? 368 00:17:58,670 --> 00:17:59,510 Is this the person? 369 00:17:59,510 --> 00:18:00,750 Is this the person? 370 00:18:00,750 --> 00:18:02,990 But if not-- and if you find them, great. 371 00:18:02,990 --> 00:18:03,660 You call them. 372 00:18:03,660 --> 00:18:06,200 And if not, you say, no search results. 373 00:18:06,200 --> 00:18:08,400 But I bet we can do even better than that. 374 00:18:08,400 --> 00:18:10,233 And we can do this not by even considering 375 00:18:10,233 --> 00:18:12,650 the digital world, but perhaps something a little more old 376 00:18:12,650 --> 00:18:15,330 school and physical, like this thing here. 377 00:18:15,330 --> 00:18:19,015 So on campus, I grabbed a phone book of the greater Boston area. 378 00:18:19,015 --> 00:18:21,140 A phone book, if you've not had occasion to use it, 379 00:18:21,140 --> 00:18:23,780 has a whole bunch of names and numbers alphabetically 380 00:18:23,780 --> 00:18:27,540 from A to Z, and so that I can go ahead and look up people in this same phone 381 00:18:27,540 --> 00:18:28,040 book. 382 00:18:28,040 --> 00:18:33,140 And only because her video is on right now, 383 00:18:33,140 --> 00:18:35,570 Talia Kahan-- if I'm saying that right-- can I 384 00:18:35,570 --> 00:18:38,720 pretend here to search for your phone number in this phone book. 385 00:18:38,720 --> 00:18:40,700 Probably not going to be there if you're not from Greater Boston, 386 00:18:40,700 --> 00:18:42,270 but we'll pretend none the less. 387 00:18:42,270 --> 00:18:43,040 TALIA KAHAN: Sure, go ahead. 388 00:18:43,040 --> 00:18:44,160 DAVID MALAN: All right, so here we go. 389 00:18:44,160 --> 00:18:46,880 So Talia, I'm going to start at the beginning on page 1 here. 390 00:18:46,880 --> 00:18:50,070 And I don't see Kahan, if I'm saying that right. 391 00:18:50,070 --> 00:18:51,320 TALIA KAHAN: Yeah, you got it. 392 00:18:51,320 --> 00:18:55,730 DAVID MALAN: So I'm going to keep going to page 2, to page 3, to page 4, 393 00:18:55,730 --> 00:18:57,800 to page 5, and I still don't see her. 394 00:18:57,800 --> 00:18:59,870 But eventually, I think I'll find it. 395 00:18:59,870 --> 00:19:02,570 Indeed, is this algorithm correct? 396 00:19:02,570 --> 00:19:05,840 I am step by step going through the 8 one page at a time, 397 00:19:05,840 --> 00:19:08,970 paying attention hopefully, looking for Talia's last name. 398 00:19:08,970 --> 00:19:11,550 And if I find it, I'll go ahead and actually call her. 399 00:19:11,550 --> 00:19:14,630 So maybe by a show of heads nodding or shaking, 400 00:19:14,630 --> 00:19:18,310 is this algorithm correct would you say? 401 00:19:18,310 --> 00:19:20,690 Feel free to say yes or no in the chat too. 402 00:19:20,690 --> 00:19:23,480 Yeah, Nathan Lee in the chat proposes correct but slow. 403 00:19:23,480 --> 00:19:26,480 All right, so let me do a little better, because Talia's name's going 404 00:19:26,480 --> 00:19:29,070 to be a little further down, so let me do two pages at a time. 405 00:19:29,070 --> 00:19:35,180 So let me go ahead and hold this up here and 2, 4, 6, 8, 10, 12, and so forth. 406 00:19:35,180 --> 00:19:36,830 Talia, is this algorithm correct? 407 00:19:36,830 --> 00:19:40,250 If you don't mind my calling on you yourself. 408 00:19:40,250 --> 00:19:43,400 TALIA KAHAN: I think it is, as long as it's possible, once you get to a Ks, 409 00:19:43,400 --> 00:19:46,310 for example, to then start going page by page. 410 00:19:46,310 --> 00:19:47,060 DAVID MALAN: Yeah. 411 00:19:47,060 --> 00:19:50,760 Because in a corner case, so to speak, in a bad situation, 412 00:19:50,760 --> 00:19:54,680 I might get a little unlucky and Talia's last name is in the middle of two pages 413 00:19:54,680 --> 00:19:55,920 that I'm flying by. 414 00:19:55,920 --> 00:19:58,640 So I probably want to slow down preemptively, or at least, 415 00:19:58,640 --> 00:20:02,570 if I maybe hit the L section after the K section, 416 00:20:02,570 --> 00:20:05,300 I might want to double back at least a page, just to make sure 417 00:20:05,300 --> 00:20:06,530 that I didn't miss her name. 418 00:20:06,530 --> 00:20:09,830 But of course, this is not how we would likely search a phone book, 419 00:20:09,830 --> 00:20:11,090 certainly in the general case. 420 00:20:11,090 --> 00:20:13,382 And this is not how your phone probably does it either. 421 00:20:13,382 --> 00:20:15,650 Odds are, your phone does the equivalent digitally 422 00:20:15,650 --> 00:20:19,010 of maybe jumping to the middle, looking down at this page here, 423 00:20:19,010 --> 00:20:20,620 and oh, I did go a little too far. 424 00:20:20,620 --> 00:20:22,162 I'm in the M section now. 425 00:20:22,162 --> 00:20:25,370 But what we can do here-- and I'll sort of step back so that you can see this 426 00:20:25,370 --> 00:20:25,880 more-- 427 00:20:25,880 --> 00:20:30,780 I can now tear this problem in half, throw half of the problem away. 428 00:20:30,780 --> 00:20:34,760 So if I started with 1,000 pages, now I'm down to just 500 pages. 429 00:20:34,760 --> 00:20:36,160 And what can I do next? 430 00:20:36,160 --> 00:20:38,540 Well, I could just start going page by page, but no. 431 00:20:38,540 --> 00:20:40,550 I can be smarter again and again. 432 00:20:40,550 --> 00:20:42,770 I'll go to the middle of the remaining half. 433 00:20:42,770 --> 00:20:45,830 Now I went a little too far to the left, I'm in the G section, 434 00:20:45,830 --> 00:20:48,190 so I'm going to go ahead and tear the problem in half 435 00:20:48,190 --> 00:20:50,390 again, throw the left half away. 436 00:20:50,390 --> 00:20:53,800 So now I'm from 1,000 to 500 to 250 pages. 437 00:20:53,800 --> 00:20:58,510 And I bet I can repeat, repeat, repeat this process until finally hopefully 438 00:20:58,510 --> 00:21:03,760 we're left with just one single page on which Talia Kahan's name is or is not, 439 00:21:03,760 --> 00:21:07,510 at which point I can definitively call or not call her. 440 00:21:07,510 --> 00:21:10,240 And so this is an example of indeed an algorithm. 441 00:21:10,240 --> 00:21:13,130 Step by step instructions for solving some problem, 442 00:21:13,130 --> 00:21:16,370 but progressively better and better and better. 443 00:21:16,370 --> 00:21:19,735 In fact, that first algorithm would have taken me 1,000 steps in the worst case. 444 00:21:19,735 --> 00:21:22,610 If Talia's name just happened to maybe start with a Z instead of a K, 445 00:21:22,610 --> 00:21:24,402 it would have taken me forever to find her. 446 00:21:24,402 --> 00:21:27,100 The second algorithm would have taken me half as much time, 447 00:21:27,100 --> 00:21:28,750 but still a decent amount of time. 448 00:21:28,750 --> 00:21:33,790 Because there's still 500 pairs of pages that I could flip through at a time. 449 00:21:33,790 --> 00:21:35,920 But that third algorithm, does anyone want 450 00:21:35,920 --> 00:21:39,790 to estimate in the chat how many steps maximally would 451 00:21:39,790 --> 00:21:44,560 it have taken me to find Talia Kahan in a 1,000 page phone book 452 00:21:44,560 --> 00:21:48,483 if I had kept dividing and conquering, dividing and conquering? 453 00:21:48,483 --> 00:21:50,650 Yeah, I'm seeing a bunch of good estimates in there, 454 00:21:50,650 --> 00:21:53,150 and even one more precise mathematically. 455 00:21:53,150 --> 00:21:56,070 So it's a roughly 10, depending on how we round and solve 456 00:21:56,070 --> 00:21:57,070 the problem in practice. 457 00:21:57,070 --> 00:22:02,140 But only 10 steps out of 1,000 pages to actually find Talia or more generally, 458 00:22:02,140 --> 00:22:03,640 anyone's number. 459 00:22:03,640 --> 00:22:06,423 And so algorithms really are this key part of problem-solving. 460 00:22:06,423 --> 00:22:09,340 And once we've got that, we've got some way of representing a problem, 461 00:22:09,340 --> 00:22:12,220 whether it's with hands on the finger or light bulbs or 0s 462 00:22:12,220 --> 00:22:15,760 and 1s or physical pieces of paper, we can take those things as input, 463 00:22:15,760 --> 00:22:18,580 and ideally solve problems as output. 464 00:22:18,580 --> 00:22:21,760 And what programming itself is all about, if unfamiliar-- 465 00:22:21,760 --> 00:22:25,030 and indeed I should note that within CS50 2/3 466 00:22:25,030 --> 00:22:29,600 of students who take CS50 at Harvard have never taken a course before. 467 00:22:29,600 --> 00:22:32,692 Which is to say you're in very good company whether you have or have not. 468 00:22:32,692 --> 00:22:35,650 And indeed, within the course, do we have different tracks for students 469 00:22:35,650 --> 00:22:37,450 with and without experience? 470 00:22:37,450 --> 00:22:39,460 Those less comfortable and more comfortable. 471 00:22:39,460 --> 00:22:41,815 Even if you've not programmed before, what programming 472 00:22:41,815 --> 00:22:44,440 really is is something that looks a little something like this. 473 00:22:44,440 --> 00:22:49,270 If I were to now translate my algorithm to code or pseudocode, so to speak-- 474 00:22:49,270 --> 00:22:51,160 in sort of this English-like syntax-- 475 00:22:51,160 --> 00:22:53,830 I might first formalize it as, pick up phone book. 476 00:22:53,830 --> 00:22:55,990 Then step two, open to middle of phone book. 477 00:22:55,990 --> 00:22:59,050 Step three, look at page Step four, if person-- 478 00:22:59,050 --> 00:23:02,740 Talia in this case-- is on page, then call that person 479 00:23:02,740 --> 00:23:04,690 And I'm indenting it deliberately to the right 480 00:23:04,690 --> 00:23:09,280 to make clear that I should only do line 5 if line 4 is applicable. 481 00:23:09,280 --> 00:23:12,717 Then in step six, Else if the person Talia is earlier in the book, 482 00:23:12,717 --> 00:23:14,800 I'm presumably going to want to open to the middle 483 00:23:14,800 --> 00:23:16,480 of the left half of the book. 484 00:23:16,480 --> 00:23:20,470 And then go back to line 3, thereby looking at the page 485 00:23:20,470 --> 00:23:22,810 and then checking again and again, that same process. 486 00:23:22,810 --> 00:23:25,870 But if the person is later in the book, I instead 487 00:23:25,870 --> 00:23:28,360 want to open to the middle of the right half of the book. 488 00:23:28,360 --> 00:23:31,390 Then go back to line 3 again, and just repeat this process 489 00:23:31,390 --> 00:23:33,160 as I did in reality. 490 00:23:33,160 --> 00:23:35,710 Lastly though, to consider one final case, 491 00:23:35,710 --> 00:23:37,840 what if the person is not in there? 492 00:23:37,840 --> 00:23:42,800 I should Else, just quit if the person cannot, in fact, be found. 493 00:23:42,800 --> 00:23:47,257 And so while this is not C or C++ or Java or JavaScript or languages that 494 00:23:47,257 --> 00:23:49,840 you might have generally heard of or maybe even used yourself, 495 00:23:49,840 --> 00:23:52,300 it's code in the sense that it's a very methodical, 496 00:23:52,300 --> 00:23:56,200 precise translation of what you're supposed to do when compelling 497 00:23:56,200 --> 00:23:58,840 a computer to solve some problem for you. 498 00:23:58,840 --> 00:24:02,320 And it's apropos that I actually looked back at my own notes. 499 00:24:02,320 --> 00:24:04,960 When I took CS50 myself some 25 years ago, 500 00:24:04,960 --> 00:24:09,400 sophomore year, I found this, which was my second sheet of notes in my binder. 501 00:24:09,400 --> 00:24:11,620 That of all my classes, I still hung on to. 502 00:24:11,620 --> 00:24:15,280 And if you'll zoom in on this, it looks like Professor [INAUDIBLE] at the time 503 00:24:15,280 --> 00:24:18,040 taught me that an algorithm is a precise sequence of steps 504 00:24:18,040 --> 00:24:20,890 for getting something done-- just another formulation of the same. 505 00:24:20,890 --> 00:24:25,390 And what was apparently important to me that day was precision and correctness. 506 00:24:25,390 --> 00:24:27,970 Correctness being, does it solve the problem right? 507 00:24:27,970 --> 00:24:30,700 But precision itself is pretty key too. 508 00:24:30,700 --> 00:24:33,190 Because you and I, every day-- when we talk to each other, 509 00:24:33,190 --> 00:24:36,610 when we give instructions, when we request things by phone or in person-- 510 00:24:36,610 --> 00:24:38,020 we take certain liberties. 511 00:24:38,020 --> 00:24:39,650 And we read between the lines. 512 00:24:39,650 --> 00:24:41,380 And we know what you mean. 513 00:24:41,380 --> 00:24:44,980 And if you're not precise, computers are not that smart. 514 00:24:44,980 --> 00:24:47,950 They can only do what we tell them precisely to do. 515 00:24:47,950 --> 00:24:52,090 They're fast, which means they might really quickly do something wrong 516 00:24:52,090 --> 00:24:55,930 unless we are precise and correct when it comes to writing that code. 517 00:24:55,930 --> 00:24:59,830 And in our final moments here today, formally, after which we'll officially 518 00:24:59,830 --> 00:25:03,940 disjoin and invite folks to chat one on one if you would like to stick around, 519 00:25:03,940 --> 00:25:07,360 thought we'd do one final example involving one of you. 520 00:25:07,360 --> 00:25:10,360 And Talia, if you don't mind, only because I summoned you earlier, would 521 00:25:10,360 --> 00:25:13,580 you like to be on the flip side here and take over the mic in a moment? 522 00:25:13,580 --> 00:25:14,500 TALIA KAHAN: Sure. 523 00:25:14,500 --> 00:25:18,450 DAVID MALAN: All right, so I'm going to go ahead and a directly message a URL 524 00:25:18,450 --> 00:25:20,080 to Talia only. 525 00:25:20,080 --> 00:25:24,070 And if everyone else, if you have access to a sheet of paper or a pen or pencil, 526 00:25:24,070 --> 00:25:25,900 go ahead and grab that now. 527 00:25:25,900 --> 00:25:27,880 Talia, what I'm going to do secretly here 528 00:25:27,880 --> 00:25:31,300 is message you a URL to open up only on your computer. 529 00:25:31,300 --> 00:25:32,860 No need to share your screen. 530 00:25:32,860 --> 00:25:35,560 And what I've sent to Talia is a picture. 531 00:25:35,560 --> 00:25:38,410 It's a picture of something that the rest of us 532 00:25:38,410 --> 00:25:41,780 are ideally going to now draw on that sheet of paper. 533 00:25:41,780 --> 00:25:45,730 This being an algorithm, whereby Talia is going to program all of us verbally, 534 00:25:45,730 --> 00:25:49,560 so to speak, giving us step by step instructions for drawing what it is she 535 00:25:49,560 --> 00:25:52,200 and only she is seeing on her screen. 536 00:25:52,200 --> 00:25:54,540 And then after she's given us all of her instructions, 537 00:25:54,540 --> 00:25:58,170 we'll all hold up to our cameras, if you're comfy, to show her, and then 538 00:25:58,170 --> 00:26:00,060 turn me, what we've drawn. 539 00:26:00,060 --> 00:26:02,880 So Talia, you can say anything you want, but you may not 540 00:26:02,880 --> 00:26:05,290 gesture physically to help folks out. 541 00:26:05,290 --> 00:26:06,290 TALIA KAHAN: OK, got it. 542 00:26:06,290 --> 00:26:07,457 DAVID MALAN: Floor is yours. 543 00:26:07,457 --> 00:26:12,630 TALIA KAHAN: So I guess step one is to draw a diamond that 544 00:26:12,630 --> 00:26:15,480 has four sides of all equal length and 90 degree 545 00:26:15,480 --> 00:26:19,140 angles between each of the sides. 546 00:26:19,140 --> 00:26:28,670 And then-- OK, so then step two is for the bottom three corners per se, 547 00:26:28,670 --> 00:26:30,890 draw a vertical line down. 548 00:26:30,890 --> 00:26:37,850 And all those lines should also be the same length as the initial diamond. 549 00:26:37,850 --> 00:26:42,230 And then-- how do I explain this? 550 00:26:42,230 --> 00:26:44,570 The last step, you're going to draw two more lines, 551 00:26:44,570 --> 00:26:49,697 and that's going to be connecting the bottom of the vertical lines. 552 00:26:49,697 --> 00:26:51,530 So those two more lines that you draw should 553 00:26:51,530 --> 00:26:56,540 be parallel to the two bottom lines of the initial diamond. 554 00:26:56,540 --> 00:26:58,160 DAVID MALAN: All right. 555 00:26:58,160 --> 00:26:59,330 Step by step done. 556 00:26:59,330 --> 00:27:02,150 If you're comfy sharing on your camera your sheet of paper, 557 00:27:02,150 --> 00:27:06,476 hold it still for a few seconds so your camera can focus. 558 00:27:06,476 --> 00:27:10,242 Talia, we'll let you give some judgmental looks at whether or not-- 559 00:27:10,242 --> 00:27:10,950 TALIA KAHAN: Yes. 560 00:27:10,950 --> 00:27:13,050 DAVID MALAN: Yeah, most of these are spot on. 561 00:27:13,050 --> 00:27:15,670 Slightly different proportions, perhaps, but indeed, 562 00:27:15,670 --> 00:27:17,670 Talia what was it, at a higher conceptual level, 563 00:27:17,670 --> 00:27:19,710 were you asking people to draw? 564 00:27:19,710 --> 00:27:20,543 TALIA KAHAN: A cube. 565 00:27:20,543 --> 00:27:21,752 DAVID MALAN: Yeah, so a cube. 566 00:27:21,752 --> 00:27:23,550 And this is actually where we would pick up 567 00:27:23,550 --> 00:27:27,390 this fall if you choose to join us is this concept of what Talia just 568 00:27:27,390 --> 00:27:30,150 did was to be very, very precise, but oh my God, 569 00:27:30,150 --> 00:27:33,480 if you had to program everything at that low level, programming 570 00:27:33,480 --> 00:27:34,855 itself just becomes mind-numbing. 571 00:27:34,855 --> 00:27:37,188 And you get really stuck in the weeds, and you can't see 572 00:27:37,188 --> 00:27:38,910 the forest for the trees, so to speak. 573 00:27:38,910 --> 00:27:41,477 Talia could have just said, draw a cube. 574 00:27:41,477 --> 00:27:44,310 But a cube is what we would call in computer science an abstraction. 575 00:27:44,310 --> 00:27:47,610 Sort of a higher level simplification of what it is you want to draw. 576 00:27:47,610 --> 00:27:50,220 But before you can draw a cube, you need to define it. 577 00:27:50,220 --> 00:27:52,140 And when you write code, you write things 578 00:27:52,140 --> 00:27:56,940 that are called functions, which are code incarnations of ideas like this. 579 00:27:56,940 --> 00:28:00,540 But hereafter, now that all of you have been programmed to draw a cube, 580 00:28:00,540 --> 00:28:03,960 if Talia now says, now, remember, that is how to draw a cube. 581 00:28:03,960 --> 00:28:06,120 Any time she wants to program something else 582 00:28:06,120 --> 00:28:08,250 or draw some other picture that involves cubes, 583 00:28:08,250 --> 00:28:09,950 she can now use that as an abstraction. 584 00:28:09,950 --> 00:28:12,180 And say, OK, everyone, draw a cube. 585 00:28:12,180 --> 00:28:16,890 Maybe parameterizing it or customizing it only in the sense of maybe how tall 586 00:28:16,890 --> 00:28:20,040 or how wide or how elongated it should perhaps be. 587 00:28:20,040 --> 00:28:22,500 So Talia, thank you so much for that. 588 00:28:22,500 --> 00:28:25,740 In our final moments together, going to play a 60 second video 589 00:28:25,740 --> 00:28:28,647 that is all thanks to the Harvard-Radcliffe Orchestra. 590 00:28:28,647 --> 00:28:30,480 The video clip you saw at the very beginning 591 00:28:30,480 --> 00:28:32,670 if you joined us right on time was actually 592 00:28:32,670 --> 00:28:36,330 music that was designed by an alum, and ultimately now performed 593 00:28:36,330 --> 00:28:37,830 by the Harvard-Radcliffe Orchestra. 594 00:28:37,830 --> 00:28:41,592 Who we would ideally too would have had in Sanders with us here today, 595 00:28:41,592 --> 00:28:43,050 as well as in this fall to perform. 596 00:28:43,050 --> 00:28:46,800 But wonderfully, everyone on the orchestra filmed themselves some months 597 00:28:46,800 --> 00:28:50,168 ago on their cameras so as to stitch this following video together. 598 00:28:50,168 --> 00:28:51,960 And after this, you're welcome to drop off. 599 00:28:51,960 --> 00:28:55,020 But I'll stick around with our team for any one on one questions. 600 00:28:55,020 --> 00:28:57,105 Andrew, go ahead if you could and hit Play. 601 00:28:57,105 --> 00:28:59,910 602 00:28:59,910 --> 00:29:01,590 SPEAKER: 1, 2, 3, 4. 603 00:29:01,590 --> 00:29:04,940 [MUSIC PLAYING] 604 00:29:04,940 --> 00:29:59,000