1 00:00:00,000 --> 00:00:02,093 2 00:00:02,093 --> 00:00:04,010 CARTER ZENKE: All right, and for this session, 3 00:00:04,010 --> 00:00:10,610 we'll transition from you being students to you being teachers of CS50. 4 00:00:10,610 --> 00:00:15,230 And as a teacher, one of your goals is to give feedback, 5 00:00:15,230 --> 00:00:19,730 to tell students what they're doing well and what they could be doing better. 6 00:00:19,730 --> 00:00:21,530 That's a really important skill. 7 00:00:21,530 --> 00:00:24,140 And so today, we're going to practice doing just that. 8 00:00:24,140 --> 00:00:28,730 How do we give good feedback for people who are learning computer science? 9 00:00:28,730 --> 00:00:33,500 How do you help them succeed in what they want to do in computer science? 10 00:00:33,500 --> 00:00:35,090 So I have a few goals for today. 11 00:00:35,090 --> 00:00:40,610 The first one is to learn about good design of code. 12 00:00:40,610 --> 00:00:44,730 I assume that when you submitted your problem sets, the code was correct. 13 00:00:44,730 --> 00:00:45,230 Yes? 14 00:00:45,230 --> 00:00:47,450 Sometimes, at least, the code is correct sometimes. 15 00:00:47,450 --> 00:00:48,980 It worked. 16 00:00:48,980 --> 00:00:51,170 But there's another question. 17 00:00:51,170 --> 00:00:53,510 How well did it work? 18 00:00:53,510 --> 00:00:55,040 Could it have worked better? 19 00:00:55,040 --> 00:00:59,030 Was it efficient, or could it have been more efficient? 20 00:00:59,030 --> 00:01:01,280 So we'll learn today about code design. 21 00:01:01,280 --> 00:01:03,090 How well is this code written? 22 00:01:03,090 --> 00:01:06,360 How could it be improved, even if it is correct? 23 00:01:06,360 --> 00:01:10,680 We'll also practice grading code, practice giving feedback. 24 00:01:10,680 --> 00:01:14,160 You'll take a look at some examples of student code 25 00:01:14,160 --> 00:01:18,270 that real students have written, not you, but real students have written. 26 00:01:18,270 --> 00:01:20,850 And you'll practice giving feedback on that code 27 00:01:20,850 --> 00:01:23,130 as if you were their teacher, OK? 28 00:01:23,130 --> 00:01:26,370 How could you help them design a better program? 29 00:01:26,370 --> 00:01:28,950 Our next goal is to learn to differentiate 30 00:01:28,950 --> 00:01:31,950 between better and worse design. 31 00:01:31,950 --> 00:01:37,410 What makes one program better designed than some other program? 32 00:01:37,410 --> 00:01:41,700 How do we know what to look for to see is this code well-designed or is it 33 00:01:41,700 --> 00:01:42,990 not well-designed? 34 00:01:42,990 --> 00:01:47,010 These are our three goals for today. 35 00:01:47,010 --> 00:01:50,230 YULIIA ZHUKOVETS: All right, so next, we're 36 00:01:50,230 --> 00:01:53,380 going to transition to talk about three grading axes. 37 00:01:53,380 --> 00:01:59,260 So CS50, across Harvard College, Yale College Extension School, the X 38 00:01:59,260 --> 00:02:03,670 community and now for Indonesia teachers, really great 39 00:02:03,670 --> 00:02:05,620 along the three grading axes. 40 00:02:05,620 --> 00:02:07,390 The first of them is correctness. 41 00:02:07,390 --> 00:02:11,110 So something all of you already familiar with correctness 42 00:02:11,110 --> 00:02:14,740 is when you get all smiley faces on check50, right? 43 00:02:14,740 --> 00:02:19,720 So when your code runs well, when it executes according to the spec, when 44 00:02:19,720 --> 00:02:20,920 it passes all the tests. 45 00:02:20,920 --> 00:02:24,550 So one of the grading axes is correctness, 46 00:02:24,550 --> 00:02:29,080 using the check50, the algorithm, right, that Rongxin and the team 47 00:02:29,080 --> 00:02:30,640 built back at Harvard. 48 00:02:30,640 --> 00:02:33,400 And this is quite simple, right? 49 00:02:33,400 --> 00:02:38,380 You just click a button or run check50, and then it spits it out in the terminal 50 00:02:38,380 --> 00:02:40,540 if the code was correct. 51 00:02:40,540 --> 00:02:43,060 The next grading axis is style. 52 00:02:43,060 --> 00:02:48,980 So some of you might be familiar with was a little tiny style50 button on top 53 00:02:48,980 --> 00:02:51,140 of the CS50.dev environment. 54 00:02:51,140 --> 00:02:53,840 If you click that button, it will tell you 55 00:02:53,840 --> 00:02:58,070 if your code is indented correctly, if there are enough spaces. 56 00:02:58,070 --> 00:03:00,560 Maybe you have too many spaces, right? 57 00:03:00,560 --> 00:03:04,940 It would kind of tell you how you can make your code more aesthetically 58 00:03:04,940 --> 00:03:08,390 pleasing, right, so that it's very uniform 59 00:03:08,390 --> 00:03:12,950 and it's looking according to some standards in computer science. 60 00:03:12,950 --> 00:03:15,980 Now, there is the third axis that you might not be 61 00:03:15,980 --> 00:03:18,560 familiar with which is called design. 62 00:03:18,560 --> 00:03:22,460 And so this is exactly what we'll be talking about today. 63 00:03:22,460 --> 00:03:25,400 And what exactly is design, right? 64 00:03:25,400 --> 00:03:27,590 We talked about code being correct. 65 00:03:27,590 --> 00:03:30,530 We talked about code being aesthetically pleasing. 66 00:03:30,530 --> 00:03:37,460 Design is how Carter earlier mentioned is really about having efficient code, 67 00:03:37,460 --> 00:03:40,370 having that one perfect solution, where you 68 00:03:40,370 --> 00:03:46,110 don't have five different FOR loops and 10 different IF statements, right? 69 00:03:46,110 --> 00:03:51,560 It's a very succinct, so simple code that someone else that's not maybe 70 00:03:51,560 --> 00:03:56,750 familiar with CS50 can easily trace and understand what you, as a programmer, 71 00:03:56,750 --> 00:03:57,410 wrote. 72 00:03:57,410 --> 00:04:00,780 Code that has good comments and variable names. 73 00:04:00,780 --> 00:04:03,290 So all of those things are called design. 74 00:04:03,290 --> 00:04:08,660 And unlike style50 or check50, this is not exactly something 75 00:04:08,660 --> 00:04:11,780 that we can program computer to do, right? 76 00:04:11,780 --> 00:04:14,780 Like, it can maybe check for the number of comments, 77 00:04:14,780 --> 00:04:18,589 but it can't really check if the comments are relevant, right? 78 00:04:18,589 --> 00:04:21,440 Maybe I'm writing completely random comments 79 00:04:21,440 --> 00:04:22,910 that are not related to my code. 80 00:04:22,910 --> 00:04:25,670 Well, that's bad design, OK? 81 00:04:25,670 --> 00:04:29,630 So today, we will actually talk about different programs. 82 00:04:29,630 --> 00:04:33,050 So we'll jump into readability, Caesar, and then you'll 83 00:04:33,050 --> 00:04:38,990 get to then grade and give feedback on some other problem set that I'm 84 00:04:38,990 --> 00:04:41,180 going to keep in secret for now. 85 00:04:41,180 --> 00:04:43,020 It will be a little surprise for you. 86 00:04:43,020 --> 00:04:48,290 But next we're going to jump into actually how to grade design, right? 87 00:04:48,290 --> 00:04:54,440 I gave you some overview to think about maybe inefficiencies or how 88 00:04:54,440 --> 00:04:57,830 to make code more succinct and simple. 89 00:04:57,830 --> 00:05:01,250 But Carter will actually help us understand how to grade it, 90 00:05:01,250 --> 00:05:04,550 how to assign it a specific score. 91 00:05:04,550 --> 00:05:07,280 CARTER ZENKE: As Yuliia mentioned, the idea of design 92 00:05:07,280 --> 00:05:10,280 is that we have to grade this as humans. 93 00:05:10,280 --> 00:05:13,250 A computer can't tell us whether the code works or not. 94 00:05:13,250 --> 00:05:17,690 We have to actually say is this code as well designed as it could be? 95 00:05:17,690 --> 00:05:21,320 It requires your input as a human, as a teacher, to talk to the student 96 00:05:21,320 --> 00:05:24,800 and say, how could you improve what you wrote, OK? 97 00:05:24,800 --> 00:05:28,460 So the code is good, but how could you make it even better, right? 98 00:05:28,460 --> 00:05:33,050 And at CS50, we have one suggestion, which you can take or not, 99 00:05:33,050 --> 00:05:36,110 which is to grade design on a five-point scale. 100 00:05:36,110 --> 00:05:37,130 Five is the best. 101 00:05:37,130 --> 00:05:38,390 It's the perfect design. 102 00:05:38,390 --> 00:05:40,970 This code could not be any better written. 103 00:05:40,970 --> 00:05:42,800 Cannot get better than that. 104 00:05:42,800 --> 00:05:47,180 Now, below a five would be a four, which is still great design. 105 00:05:47,180 --> 00:05:48,620 The student did well. 106 00:05:48,620 --> 00:05:53,060 They used a lot of the concepts, but there are still one or two 107 00:05:53,060 --> 00:05:55,640 potential improvements, things they could 108 00:05:55,640 --> 00:06:00,320 have done to have been even better with how they wrote their code. 109 00:06:00,320 --> 00:06:03,290 Next would be a three, which is good design. 110 00:06:03,290 --> 00:06:07,730 The student did good, but there were still one or two inefficiencies 111 00:06:07,730 --> 00:06:10,340 that they could have improved, things they could have improved 112 00:06:10,340 --> 00:06:13,310 to make their code work better, right? 113 00:06:13,310 --> 00:06:15,770 Below a three would be a two, and below a two 114 00:06:15,770 --> 00:06:17,420 would be a one, if we can go ahead. 115 00:06:17,420 --> 00:06:20,840 And this symbolizes kind of worse and even worse design. 116 00:06:20,840 --> 00:06:22,880 That the student solved the problem correctly, 117 00:06:22,880 --> 00:06:24,860 but they didn't do it in a very efficient way. 118 00:06:24,860 --> 00:06:29,000 There are things they could still improve, very much so, in fact. 119 00:06:29,000 --> 00:06:31,070 So we think of these things as like a one to five 120 00:06:31,070 --> 00:06:37,130 scale, where five is the best design, and one is the worst design, OK? 121 00:06:37,130 --> 00:06:39,260 So this is only one suggestion. 122 00:06:39,260 --> 00:06:42,440 You can take your own ideas, too, and apply them here. 123 00:06:42,440 --> 00:06:46,420 Sometimes I will like to use a three-point scale, where three 124 00:06:46,420 --> 00:06:48,460 is the best, and one is the worst. 125 00:06:48,460 --> 00:06:51,130 You can even do a 10-point scale, from 1 to 10. 126 00:06:51,130 --> 00:06:53,950 You could even not use numbers at all. 127 00:06:53,950 --> 00:06:57,850 You could use words, like excellent or great or good 128 00:06:57,850 --> 00:07:00,310 or could be better, could be improved. 129 00:07:00,310 --> 00:07:01,540 It's up to you. 130 00:07:01,540 --> 00:07:05,980 But for today, we'll use CS50's approach, which is five-point scale. 131 00:07:05,980 --> 00:07:07,240 Five is the best. 132 00:07:07,240 --> 00:07:09,850 One is the worst, OK? 133 00:07:09,850 --> 00:07:15,970 And most students in CS50, like the code you'll see today, might not be a five. 134 00:07:15,970 --> 00:07:17,020 Five is perfect. 135 00:07:17,020 --> 00:07:18,550 Cannot be improved. 136 00:07:18,550 --> 00:07:22,738 Most students submit code that is usually a three or a four. 137 00:07:22,738 --> 00:07:25,030 It's good or it's great, but there's still a few things 138 00:07:25,030 --> 00:07:28,270 that they could improve, OK? 139 00:07:28,270 --> 00:07:31,360 All right, now let's see some examples. 140 00:07:31,360 --> 00:07:34,810 YULIIA ZHUKOVETS: All right, so we talked about correctness and style 141 00:07:34,810 --> 00:07:39,550 and design and how to grade it, perfect code or code that can be improved. 142 00:07:39,550 --> 00:07:43,570 Now let's actually see some examples so that we can practice giving the score. 143 00:07:43,570 --> 00:07:46,940 And maybe we can also even do a little vote ourselves. 144 00:07:46,940 --> 00:07:50,600 So our first example would be on readability, right? 145 00:07:50,600 --> 00:07:54,810 The P set that everyone should be familiar with, where the goal of the P 146 00:07:54,810 --> 00:07:58,490 set was given a prompt from a user, which is some text, 147 00:07:58,490 --> 00:08:02,150 calculate the number of letters, words, and sentences, 148 00:08:02,150 --> 00:08:04,850 and then using a specific formula, we can 149 00:08:04,850 --> 00:08:09,740 calculate an index that will tell us maybe how complex that text is. 150 00:08:09,740 --> 00:08:15,590 So today we will take a look at two snippets of code, 151 00:08:15,590 --> 00:08:20,360 where we specifically focus on calculating the number of letters. 152 00:08:20,360 --> 00:08:24,920 So before we jump in, let me just take a few minutes to walk through the code 153 00:08:24,920 --> 00:08:26,960 to explain exactly what's happening. 154 00:08:26,960 --> 00:08:30,740 So first we can see that we have a main function, right? 155 00:08:30,740 --> 00:08:32,600 There was some code that was written before. 156 00:08:32,600 --> 00:08:38,000 Maybe we did get string to get user's input, and we processed that. 157 00:08:38,000 --> 00:08:41,059 And so maybe we already calculated some words and sentences, 158 00:08:41,059 --> 00:08:45,890 but this is specifically a part for calculating number of letters. 159 00:08:45,890 --> 00:08:50,300 So first thing that we see is declaring a variable, called L. 160 00:08:50,300 --> 00:08:53,480 And we're giving it a type float. 161 00:08:53,480 --> 00:08:54,800 We're setting it to zero. 162 00:08:54,800 --> 00:08:58,730 This will be sort of our counter that we will use to count the letters. 163 00:08:58,730 --> 00:09:01,160 Next, it seems like the student that wrote 164 00:09:01,160 --> 00:09:06,650 that code used a FOR loop to iterate through all of the letters in the text, 165 00:09:06,650 --> 00:09:08,430 going one by one. 166 00:09:08,430 --> 00:09:08,930 Sorry. 167 00:09:08,930 --> 00:09:11,120 The characters in the text, going one by one. 168 00:09:11,120 --> 00:09:19,220 And next, it seems like they implemented an IF statement to check each character, 169 00:09:19,220 --> 00:09:23,390 if each character is between a certain bounds of numbers. 170 00:09:23,390 --> 00:09:27,110 Maybe I'm not familiar with CS50 and I'm just looking at this code. 171 00:09:27,110 --> 00:09:29,960 These numbers don't really mean anything to me just yet, 172 00:09:29,960 --> 00:09:37,490 but I can see that in the next line, they added one to our variable L 173 00:09:37,490 --> 00:09:40,760 with every iteration, and there is some code on the bottom, right? 174 00:09:40,760 --> 00:09:44,060 Maybe this is where we implement our index formula. 175 00:09:44,060 --> 00:09:48,122 And then Carter will talk us through the second example. 176 00:09:48,122 --> 00:09:50,580 CARTER ZENKE: So you've seen one example that a student has 177 00:09:50,580 --> 00:09:54,840 submitted to us, as teachers, but you probably have more than one student. 178 00:09:54,840 --> 00:09:58,200 And so this is our second student, now, who submitted another assignment 179 00:09:58,200 --> 00:09:59,400 for the same problem. 180 00:09:59,400 --> 00:10:02,790 Still readability but this was the code that they wrote. 181 00:10:02,790 --> 00:10:07,020 Now, it's important, if a student submits code to you, 182 00:10:07,020 --> 00:10:09,720 you should try to first understand it. 183 00:10:09,720 --> 00:10:12,140 Can I tell you a secret? 184 00:10:12,140 --> 00:10:12,640 Yeah? 185 00:10:12,640 --> 00:10:13,510 Can I tell you a secret? 186 00:10:13,510 --> 00:10:14,140 OK. 187 00:10:14,140 --> 00:10:19,030 My secret is sometimes a student will send me code, and I don't understand it. 188 00:10:19,030 --> 00:10:20,550 [LAUGHTER] 189 00:10:20,550 --> 00:10:21,990 That might happen to you. 190 00:10:21,990 --> 00:10:22,530 OK? 191 00:10:22,530 --> 00:10:23,550 And that's OK. 192 00:10:23,550 --> 00:10:26,520 But what you can do is walk step-by-step to try 193 00:10:26,520 --> 00:10:28,320 to understand the code they wrote, OK? 194 00:10:28,320 --> 00:10:29,700 So we'll do that today. 195 00:10:29,700 --> 00:10:33,690 Looks like here, at the top, we have function main. 196 00:10:33,690 --> 00:10:37,120 What does main do? 197 00:10:37,120 --> 00:10:39,010 It's the start of our program, yeah. 198 00:10:39,010 --> 00:10:43,030 So the code starts up top, and it seems like with a dot 199 00:10:43,030 --> 00:10:45,250 dot dot-- do you see that, slash slash dot dot dot? 200 00:10:45,250 --> 00:10:46,060 Do you see that? 201 00:10:46,060 --> 00:10:46,870 Yes? 202 00:10:46,870 --> 00:10:49,510 That means there was some code up above that they wrote. 203 00:10:49,510 --> 00:10:51,635 We aren't going to show it here because it would be 204 00:10:51,635 --> 00:10:53,380 very long, too big for this slide, OK? 205 00:10:53,380 --> 00:10:59,650 But then we see int letters=count_letters text. 206 00:10:59,650 --> 00:11:00,700 So what does that mean? 207 00:11:00,700 --> 00:11:03,760 It seems like that the text we got from the user, 208 00:11:03,760 --> 00:11:07,840 we're giving that to our function, which is called what? 209 00:11:07,840 --> 00:11:08,630 Count letters. 210 00:11:08,630 --> 00:11:09,130 Good. 211 00:11:09,130 --> 00:11:12,480 And what does it give us back? 212 00:11:12,480 --> 00:11:14,570 It gives us back some number of letters, I think, 213 00:11:14,570 --> 00:11:17,640 because here we have a variable named letters that is an integer. 214 00:11:17,640 --> 00:11:21,620 So we'll get back a whole number, like a one, two, three, four number of letters 215 00:11:21,620 --> 00:11:23,900 in the text that we had, OK? 216 00:11:23,900 --> 00:11:28,430 OK, down below we see int count_letters string text. 217 00:11:28,430 --> 00:11:29,730 Do you see that? 218 00:11:29,730 --> 00:11:30,230 OK, good. 219 00:11:30,230 --> 00:11:31,813 That's the start of the function here. 220 00:11:31,813 --> 00:11:35,120 Then we see a comment, oh, a comment that makes things so much easier. 221 00:11:35,120 --> 00:11:37,100 So ask your students to write comments, right? 222 00:11:37,100 --> 00:11:39,110 You can help them understand their code. 223 00:11:39,110 --> 00:11:43,765 This says it returns the number of letters in the text. 224 00:11:43,765 --> 00:11:45,140 That's pretty easy to understand. 225 00:11:45,140 --> 00:11:46,640 Yeah, that's helpful, isn't it? 226 00:11:46,640 --> 00:11:47,270 Good. 227 00:11:47,270 --> 00:11:51,170 So we know that this code here from int letters=-0, 228 00:11:51,170 --> 00:11:55,490 all the way down to return letters, its goal is to return the number of letters 229 00:11:55,490 --> 00:11:56,420 in the text. 230 00:11:56,420 --> 00:11:58,040 OK, what's the first thing we do? 231 00:11:58,040 --> 00:12:00,515 Can I ask you this line here, int letters=0. 232 00:12:00,515 --> 00:12:01,265 What does that do? 233 00:12:01,265 --> 00:12:05,060 234 00:12:05,060 --> 00:12:09,830 Yeah, assigns the value zero to this variable, named letters. 235 00:12:09,830 --> 00:12:11,930 And what type is it? 236 00:12:11,930 --> 00:12:12,620 Integer. 237 00:12:12,620 --> 00:12:13,190 Good, good. 238 00:12:13,190 --> 00:12:13,690 OK. 239 00:12:13,690 --> 00:12:16,280 So we have a number, zero now. 240 00:12:16,280 --> 00:12:17,210 Its name is letters. 241 00:12:17,210 --> 00:12:19,850 So it seems like we'll count up the number of letters 242 00:12:19,850 --> 00:12:21,290 using this variable named letters. 243 00:12:21,290 --> 00:12:22,850 Does that make sense? 244 00:12:22,850 --> 00:12:25,310 OK, now we see a FOR loop. 245 00:12:25,310 --> 00:12:27,390 Uh-oh, a FOR loop. 246 00:12:27,390 --> 00:12:29,510 So what does the FOR loop do, do you think? 247 00:12:29,510 --> 00:12:30,680 If we read just this part. 248 00:12:30,680 --> 00:12:34,710 FOR int I=0 len=strlen I less than len, I plus. 249 00:12:34,710 --> 00:12:35,210 Plus. 250 00:12:35,210 --> 00:12:35,510 Ooh. 251 00:12:35,510 --> 00:12:36,275 What does that do? 252 00:12:36,275 --> 00:12:40,893 253 00:12:40,893 --> 00:12:42,060 I'm hearing some good ideas. 254 00:12:42,060 --> 00:12:44,910 So I think it iterates-- remember that word iterates? 255 00:12:44,910 --> 00:12:49,260 It iterates over every letter, every character in the text. 256 00:12:49,260 --> 00:12:54,780 So if I had maybe "hello," that's five letters, yeah? 257 00:12:54,780 --> 00:13:00,150 So I would first get H, then E-L-L-O. Good. 258 00:13:00,150 --> 00:13:02,880 OK, then I would ask a question for every character. 259 00:13:02,880 --> 00:13:07,230 Like, H-E-L-L-O if is alpha, uh-oh. 260 00:13:07,230 --> 00:13:10,170 261 00:13:10,170 --> 00:13:12,420 If it's an alphabetical letter. 262 00:13:12,420 --> 00:13:16,200 So alphabetical letter means A through Z, right? 263 00:13:16,200 --> 00:13:20,970 OK, so if it is A through Z, this particular character, what will I do? 264 00:13:20,970 --> 00:13:22,020 Add one, OK? 265 00:13:22,020 --> 00:13:24,840 So I'll add one, and once I get to the end of my text, 266 00:13:24,840 --> 00:13:27,540 it seems like I should have counted up all the letters. 267 00:13:27,540 --> 00:13:32,250 So for instance H, H is certainly between A and Z, yes? 268 00:13:32,250 --> 00:13:34,020 Add one, so from zero to one. 269 00:13:34,020 --> 00:13:35,040 E, add one again. 270 00:13:35,040 --> 00:13:35,820 That's two. 271 00:13:35,820 --> 00:13:36,660 L, add one again. 272 00:13:36,660 --> 00:13:37,480 That's three. 273 00:13:37,480 --> 00:13:37,980 Add one. 274 00:13:37,980 --> 00:13:38,480 Add one. 275 00:13:38,480 --> 00:13:40,270 That's five, right? 276 00:13:40,270 --> 00:13:42,250 So we counted up all the letters in this text. 277 00:13:42,250 --> 00:13:44,170 So we've seen now what this code does. 278 00:13:44,170 --> 00:13:45,760 I think it's correct. 279 00:13:45,760 --> 00:13:48,790 But now we could compare these two students' design. 280 00:13:48,790 --> 00:13:50,572 Which one was better written? 281 00:13:50,572 --> 00:13:52,030 Which one was easier to understand? 282 00:13:52,030 --> 00:13:53,830 And which one was more efficient? 283 00:13:53,830 --> 00:13:57,340 So here, again, are these two pieces of code side by side, 284 00:13:57,340 --> 00:14:00,370 and let's think through which one might be better. 285 00:14:00,370 --> 00:14:03,130 We'll demonstrate this first, me and Yuliia, 286 00:14:03,130 --> 00:14:07,480 and we'll later have you all do this same process in your groups, OK? 287 00:14:07,480 --> 00:14:08,602 So we'll demonstrate now. 288 00:14:08,602 --> 00:14:11,560 But you'll prepare yourself to do this later on for more code examples. 289 00:14:11,560 --> 00:14:14,680 So let me ask you, Yuliia, what do you think 290 00:14:14,680 --> 00:14:17,170 about the design of these programs? 291 00:14:17,170 --> 00:14:21,900 YULIIA ZHUKOVETS: Well, as you said, the functions seem to be correct. 292 00:14:21,900 --> 00:14:25,110 I think they're calculating the number of letters in the text, 293 00:14:25,110 --> 00:14:31,890 but I think there's some things that jump out to me that could be better. 294 00:14:31,890 --> 00:14:35,560 Maybe on the left-hand side, for example, 295 00:14:35,560 --> 00:14:41,100 I can notice that the example 2 on the right-hand side 296 00:14:41,100 --> 00:14:43,650 uses a helper function count letters. 297 00:14:43,650 --> 00:14:47,790 So inside the main, I really only need to write 298 00:14:47,790 --> 00:14:53,070 one line, where I will assign the return value to some variable letters. 299 00:14:53,070 --> 00:14:56,850 And then all the way on the bottom, I can create a separate helper 300 00:14:56,850 --> 00:14:59,070 function that will count those letters. 301 00:14:59,070 --> 00:15:01,230 It seems to me like that's better design, 302 00:15:01,230 --> 00:15:03,390 because it doesn't crowd my main function, 303 00:15:03,390 --> 00:15:10,680 and I can really focus on implementing the most fundamental steps, like getting 304 00:15:10,680 --> 00:15:14,760 the user input and calculating the index and kind of like abstracting away 305 00:15:14,760 --> 00:15:15,810 everything else. 306 00:15:15,810 --> 00:15:19,140 And kind of like comparing it to the left-hand side, 307 00:15:19,140 --> 00:15:23,230 I see that there is no helper function everything is implemented in main 308 00:15:23,230 --> 00:15:28,990 and given the amount of code it might seem to me like the example 1 309 00:15:28,990 --> 00:15:31,228 main function can get really long. 310 00:15:31,228 --> 00:15:32,770 CARTER ZENKE: Yeah, I agree with you. 311 00:15:32,770 --> 00:15:35,710 I like that this student made their own function called 312 00:15:35,710 --> 00:15:38,653 count letters, which seems to me to be a little bit clearer, maybe 313 00:15:38,653 --> 00:15:41,320 a little bit more efficient, let's say, than this one over here. 314 00:15:41,320 --> 00:15:42,237 Does that make sense? 315 00:15:42,237 --> 00:15:42,820 AUDIENCE: Yes. 316 00:15:42,820 --> 00:15:43,570 CARTER ZENKE: Yes? 317 00:15:43,570 --> 00:15:48,670 OK, one thing I notice is that this student, they, I think, 318 00:15:48,670 --> 00:15:52,620 are asking the same question but in different ways. 319 00:15:52,620 --> 00:15:53,520 Yeah? 320 00:15:53,520 --> 00:15:58,980 This student is asking the question is the letter greater than or equal to 65, 321 00:15:58,980 --> 00:16:01,860 and is the letter less than or equal to 90? 322 00:16:01,860 --> 00:16:04,710 And that's confusing to me, at least, because how could a number 323 00:16:04,710 --> 00:16:08,370 or how could a character, like A, be greater than 65? 324 00:16:08,370 --> 00:16:09,930 Does that make sense? 325 00:16:09,930 --> 00:16:12,990 I mean, it does kind of because it can. 326 00:16:12,990 --> 00:16:17,740 Because we know that in C, letters are actually numbers. 327 00:16:17,740 --> 00:16:21,060 So I think that makes sense, but if I'm a human reading 328 00:16:21,060 --> 00:16:25,710 this, it takes me one more step to understand what they're doing. 329 00:16:25,710 --> 00:16:28,590 I have to convert the character to a number in my head 330 00:16:28,590 --> 00:16:32,100 before I know what's happening in their code, right? 331 00:16:32,100 --> 00:16:34,830 Whereas this one was a little easier. 332 00:16:34,830 --> 00:16:36,840 It's almost more like English. 333 00:16:36,840 --> 00:16:39,488 If it's alphabetical, I'll add one to my number. 334 00:16:39,488 --> 00:16:42,030 This one I actually have to look at the numbers and be, like, 335 00:16:42,030 --> 00:16:42,810 is it between this? 336 00:16:42,810 --> 00:16:43,768 Is it not between this? 337 00:16:43,768 --> 00:16:45,120 It's harder to read. 338 00:16:45,120 --> 00:16:46,480 Does that make sense? 339 00:16:46,480 --> 00:16:50,130 So I would say this one is maybe better designed than that one. 340 00:16:50,130 --> 00:16:51,225 Would you agree? 341 00:16:51,225 --> 00:16:51,850 AUDIENCE: Yeah. 342 00:16:51,850 --> 00:16:53,190 CARTER ZENKE: OK. 343 00:16:53,190 --> 00:16:56,670 YULIIA ZHUKOVETS: And maybe one last tiny, tiny thing that I notice 344 00:16:56,670 --> 00:17:03,630 is that this example declares variable L as a float, 345 00:17:03,630 --> 00:17:08,640 and the second example declares variable letters as an int. 346 00:17:08,640 --> 00:17:11,400 Which one is better, int or float? 347 00:17:11,400 --> 00:17:12,699 Integer, right? 348 00:17:12,699 --> 00:17:13,199 Why? 349 00:17:13,199 --> 00:17:18,950 350 00:17:18,950 --> 00:17:20,780 Yeah, I'm hearing some good ideas. 351 00:17:20,780 --> 00:17:24,859 So I know that all of my letters will be whole numbers, right? 352 00:17:24,859 --> 00:17:27,349 There will be one or two or three. 353 00:17:27,349 --> 00:17:30,710 There can't really be 1.2 letters, right? 354 00:17:30,710 --> 00:17:34,070 And if I declare my variable as float, it 355 00:17:34,070 --> 00:17:36,680 takes up a lot more memory than an int, right? 356 00:17:36,680 --> 00:17:40,670 So that's like one tiny inefficiency that you can consider. 357 00:17:40,670 --> 00:17:46,130 So I would say that declaring variable letters, or L, 358 00:17:46,130 --> 00:17:49,670 would be better with the data type int rather than float. 359 00:17:49,670 --> 00:17:53,840 Therefore, I do think that example to the right-hand code 360 00:17:53,840 --> 00:17:55,940 would be better design. 361 00:17:55,940 --> 00:17:59,660 CARTER ZENKE: Yeah, so you've seen here three ways that these programs differ, 362 00:17:59,660 --> 00:18:02,630 and it seems like this one might be better designed 363 00:18:02,630 --> 00:18:05,840 because it made some things more efficient with those three ways, right? 364 00:18:05,840 --> 00:18:09,830 So to summarize, these were the three things we looked at in readability. 365 00:18:09,830 --> 00:18:12,950 There can be more things, too, but these are a few examples. 366 00:18:12,950 --> 00:18:16,790 So did the student use built-in functions, like isalpha, 367 00:18:16,790 --> 00:18:20,520 or did they reimplement that, for instance, with the numbers, 368 00:18:20,520 --> 00:18:23,820 like greater than 65 or less than some other number. 369 00:18:23,820 --> 00:18:27,120 Second one was does the student create helper functions, 370 00:18:27,120 --> 00:18:30,150 like count letters that help you understand their code, 371 00:18:30,150 --> 00:18:32,370 or is it all in the main function? 372 00:18:32,370 --> 00:18:36,210 It can sometimes often be better if a student creates helper functions, 373 00:18:36,210 --> 00:18:39,150 like the one we saw earlier, like count letters, right? 374 00:18:39,150 --> 00:18:42,060 Now the third thing is do they use the right data types? 375 00:18:42,060 --> 00:18:45,450 Like Yuliia said, in this case, an integer? 376 00:18:45,450 --> 00:18:48,030 Int makes much more sense than a float. 377 00:18:48,030 --> 00:18:53,190 So you could look out and see does the student use the right data types, OK? 378 00:18:53,190 --> 00:18:56,580 So these are three things to look for in readability, 379 00:18:56,580 --> 00:18:58,470 but there are probably more, too. 380 00:18:58,470 --> 00:19:02,580 As you see more student code, you'll see more things to look at, 381 00:19:02,580 --> 00:19:06,720 more things to compare across different students, OK? 382 00:19:06,720 --> 00:19:07,440 Yeah. 383 00:19:07,440 --> 00:19:09,330 YULIIA ZHUKOVETS: Carter, do you want to go back to the previous slide 384 00:19:09,330 --> 00:19:13,020 and maybe we can talk how to actually assign a score for a design, right? 385 00:19:13,020 --> 00:19:16,920 We told you that CS50 uses a scale from one to five. 386 00:19:16,920 --> 00:19:20,370 So maybe this would be a good example to maybe discuss 387 00:19:20,370 --> 00:19:24,122 what score you think each of these programs should be awarded. 388 00:19:24,122 --> 00:19:25,080 CARTER ZENKE: For sure. 389 00:19:25,080 --> 00:19:28,980 So I know that we said earlier that a five was perfect design, right? 390 00:19:28,980 --> 00:19:30,270 Five was perfect. 391 00:19:30,270 --> 00:19:35,790 Now do either of these seem perfect to you? 392 00:19:35,790 --> 00:19:36,290 No. 393 00:19:36,290 --> 00:19:38,450 I mean, there's probably improvements for each one. 394 00:19:38,450 --> 00:19:41,360 This one, I would say is pretty near perfect. 395 00:19:41,360 --> 00:19:44,330 I can't, myself, think of a better way to implement this one. 396 00:19:44,330 --> 00:19:48,500 This one though, we thought of some improvements, a few improvements, 397 00:19:48,500 --> 00:19:52,220 maybe one or two, three to four improvements, yeah? 398 00:19:52,220 --> 00:19:58,490 So I might say this one could be a three or a four on design, OK? 399 00:19:58,490 --> 00:20:02,210 This one though, I think it's pretty close to perfect, 400 00:20:02,210 --> 00:20:05,780 and so I might say if I'm being a little generous, I might say it's about five, 401 00:20:05,780 --> 00:20:06,620 right? 402 00:20:06,620 --> 00:20:10,490 Yeah, as an example, would you agree or would you disagree? 403 00:20:10,490 --> 00:20:12,140 YULIIA ZHUKOVETS: I think-- 404 00:20:12,140 --> 00:20:12,890 should I agree? 405 00:20:12,890 --> 00:20:15,680 Should I agree? 406 00:20:15,680 --> 00:20:17,390 Well, no, I think this is one. 407 00:20:17,390 --> 00:20:18,470 No I'm joking. 408 00:20:18,470 --> 00:20:20,180 [LAUGHS] All right. 409 00:20:20,180 --> 00:20:22,685 No, I think Carter got it pretty right. 410 00:20:22,685 --> 00:20:25,970 The right-hand code looks really, really good, right? 411 00:20:25,970 --> 00:20:29,300 We couldn't even find any improvements to make. 412 00:20:29,300 --> 00:20:35,300 But maybe I will point out one thing is that we don't see the rest of the code, 413 00:20:35,300 --> 00:20:36,020 right? 414 00:20:36,020 --> 00:20:40,700 So maybe their count letters function is perfect, but once we get to constants, 415 00:20:40,700 --> 00:20:41,975 it's like, boy. 416 00:20:41,975 --> 00:20:44,690 Oh no, they're using all kind of different things 417 00:20:44,690 --> 00:20:46,710 that I don't even know how to read. 418 00:20:46,710 --> 00:20:51,380 So I would say that these chunks of code might be awarded 419 00:20:51,380 --> 00:20:53,540 maybe a five and a three, respectively. 420 00:20:53,540 --> 00:20:55,940 But when you look at your student's code, 421 00:20:55,940 --> 00:21:01,940 you need to consider the whole picture, looking at all of the main function 422 00:21:01,940 --> 00:21:05,390 components and then looking at all the helper functions component 423 00:21:05,390 --> 00:21:07,890 and combining all of these things together. 424 00:21:07,890 --> 00:21:12,260 So for example, in this case, we found two or three improvements 425 00:21:12,260 --> 00:21:16,140 with just the counting number of letters part. 426 00:21:16,140 --> 00:21:18,750 But maybe there are some other things to consider 427 00:21:18,750 --> 00:21:21,535 in the other parts of the program, OK? 428 00:21:21,535 --> 00:21:23,160 CARTER ZENKE: And it is OK to disagree. 429 00:21:23,160 --> 00:21:25,110 So if Yuliia maybe disagreed with you, that would be OK. 430 00:21:25,110 --> 00:21:26,402 We can still be friends, right? 431 00:21:26,402 --> 00:21:27,900 We're still friends. 432 00:21:27,900 --> 00:21:32,130 And often, I think you'll find that somebody says this is a five, 433 00:21:32,130 --> 00:21:34,650 but somebody else might say this is a three or a four. 434 00:21:34,650 --> 00:21:38,100 And so you can talk about why you think differently, and maybe one of you 435 00:21:38,100 --> 00:21:40,980 will be persuaded to join the other side, OK? 436 00:21:40,980 --> 00:21:43,050 So let's look at one more example. 437 00:21:43,050 --> 00:21:45,632 This one is called Caesar. 438 00:21:45,632 --> 00:21:46,590 Do you remember Caesar? 439 00:21:46,590 --> 00:21:48,298 YULIIA ZHUKOVETS: Do you remember Caesar? 440 00:21:48,298 --> 00:21:49,828 Did we like Caesar? 441 00:21:49,828 --> 00:21:50,370 AUDIENCE: No. 442 00:21:50,370 --> 00:21:51,245 YULIIA ZHUKOVETS: No. 443 00:21:51,245 --> 00:21:52,890 OK, 444 00:21:52,890 --> 00:21:54,390 CARTER ZENKE: At least we're honest. 445 00:21:54,390 --> 00:21:54,932 That's great. 446 00:21:54,932 --> 00:21:58,060 447 00:21:58,060 --> 00:21:58,560 All right. 448 00:21:58,560 --> 00:22:01,470 So we have a first example here of a student who implemented 449 00:22:01,470 --> 00:22:04,298 Caesar and submitted their code to you. 450 00:22:04,298 --> 00:22:06,840 YULIIA ZHUKOVETS: All right, so as with the previous example, 451 00:22:06,840 --> 00:22:09,480 we're seeing just a little snippet of it, right? 452 00:22:09,480 --> 00:22:13,590 So maybe I'll recap what Caesar was all about, right? 453 00:22:13,590 --> 00:22:16,950 So Caesar was a really a program where you 454 00:22:16,950 --> 00:22:20,310 had to implement some encryption algorithm, where 455 00:22:20,310 --> 00:22:24,780 you would shift a letter by some number, given the user's prompt. 456 00:22:24,780 --> 00:22:30,600 So maybe instead of main, what's going on is that we're taking user's input. 457 00:22:30,600 --> 00:22:34,920 We're doing some error checking, and then we 458 00:22:34,920 --> 00:22:40,140 are implementing maybe a FOR loop that goes through each character in the code 459 00:22:40,140 --> 00:22:44,640 and then rotates them by some number or shifts them by some number 460 00:22:44,640 --> 00:22:46,500 that the user inputted. 461 00:22:46,500 --> 00:22:50,010 And so this is exactly what we're seeing on this slide, right now, right? 462 00:22:50,010 --> 00:22:53,610 We have a function to rotate a character by n positions. 463 00:22:53,610 --> 00:22:55,170 Oh, this is a really good comment. 464 00:22:55,170 --> 00:22:57,420 It tells me exactly what I need to know, right? 465 00:22:57,420 --> 00:23:01,770 Even if I maybe don't know what the code actually means, 466 00:23:01,770 --> 00:23:06,150 I can guess, just from the comment that the user inputted. 467 00:23:06,150 --> 00:23:09,030 So let's look at the function. 468 00:23:09,030 --> 00:23:15,630 First thing that they do is that they specify the parameters or arguments 469 00:23:15,630 --> 00:23:17,010 the function is going to take in. 470 00:23:17,010 --> 00:23:19,320 So a character c, int n. 471 00:23:19,320 --> 00:23:23,970 I will speculate to say that c is just a character in the text 472 00:23:23,970 --> 00:23:30,150 and then int n will be the key by which we need to rotate or shift that letter. 473 00:23:30,150 --> 00:23:33,390 And then first thing that the student did, 474 00:23:33,390 --> 00:23:37,630 they checked if the character is uppercase using an isupper function. 475 00:23:37,630 --> 00:23:41,850 So if it is uppercase, they're applying a certain algorithm 476 00:23:41,850 --> 00:23:46,350 to shift that letter by a certain amount of positions. 477 00:23:46,350 --> 00:23:50,010 Next, if the first statement wasn't true, 478 00:23:50,010 --> 00:23:53,310 they're checking if the character is lowercase, right? 479 00:23:53,310 --> 00:23:59,910 Because the algorithm will be different for lowercase and uppercase letters. 480 00:23:59,910 --> 00:24:02,070 If it is a character and it is lowercase, 481 00:24:02,070 --> 00:24:04,920 they will go into a slightly different algorithm 482 00:24:04,920 --> 00:24:07,980 to shift the letter by n number of positions. 483 00:24:07,980 --> 00:24:13,040 And lastly, they will return the character unchanged 484 00:24:13,040 --> 00:24:14,720 if it's not a letter, right? 485 00:24:14,720 --> 00:24:20,000 So at every step of the way, they're returning some kind of value, 486 00:24:20,000 --> 00:24:24,590 depending on if the condition was true or not. 487 00:24:24,590 --> 00:24:26,930 OK, how do you feel about this code? 488 00:24:26,930 --> 00:24:29,000 Does it make sense to us? 489 00:24:29,000 --> 00:24:29,810 OK. 490 00:24:29,810 --> 00:24:32,870 So maybe Carter can walk us through the next example. 491 00:24:32,870 --> 00:24:36,020 CARTER ZENKE: OK, let's see an example from one more student. 492 00:24:36,020 --> 00:24:37,940 I'm hearing some murmurs. 493 00:24:37,940 --> 00:24:40,790 This is the same function rotate, OK? 494 00:24:40,790 --> 00:24:43,070 And the goal of rotate, you remember as Yuliia said, 495 00:24:43,070 --> 00:24:47,630 was to take in some character and rotate it some number of places. 496 00:24:47,630 --> 00:24:52,670 So if I have A, my key is one. 497 00:24:52,670 --> 00:24:55,520 What should I get back? 498 00:24:55,520 --> 00:24:56,780 B, right? 499 00:24:56,780 --> 00:24:59,750 Because one after A is B. 500 00:24:59,750 --> 00:25:01,730 What if I had A and a key of two? 501 00:25:01,730 --> 00:25:02,690 What should I get? 502 00:25:02,690 --> 00:25:02,900 AUDIENCE: C. 503 00:25:02,900 --> 00:25:05,240 CARTER ZENKE: C. What if I had an A and a key of three? 504 00:25:05,240 --> 00:25:05,990 What should I get? 505 00:25:05,990 --> 00:25:06,608 AUDIENCE: D. 506 00:25:06,608 --> 00:25:07,400 CARTER ZENKE: Good. 507 00:25:07,400 --> 00:25:09,660 If I had B and a key of one, what should I get? 508 00:25:09,660 --> 00:25:10,160 AUDIENCE: C. 509 00:25:10,160 --> 00:25:11,240 CARTER ZENKE: C. OK, I think we're getting it. 510 00:25:11,240 --> 00:25:11,870 That's good. 511 00:25:11,870 --> 00:25:17,060 So here, it seems like the function rotate takes in a character, like A or B 512 00:25:17,060 --> 00:25:20,293 or C, and some key, like one or two or three or four or five or six 513 00:25:20,293 --> 00:25:21,335 or whatever it is, right? 514 00:25:21,335 --> 00:25:24,350 And we're going to rotate the character and return back 515 00:25:24,350 --> 00:25:27,950 the updated character, like we just saw in Yuliia's function earlier, too. 516 00:25:27,950 --> 00:25:30,740 Now, how does this code work? 517 00:25:30,740 --> 00:25:35,390 Well, it seems like we start with a variable called norm, 518 00:25:35,390 --> 00:25:37,670 and it's type integer, OK? 519 00:25:37,670 --> 00:25:40,730 Do we know what norm does yet? 520 00:25:40,730 --> 00:25:42,650 Mm, don't really know yet, but we'll see. 521 00:25:42,650 --> 00:25:45,140 So then we ask a question. 522 00:25:45,140 --> 00:25:53,990 If C is greater than or equal to A and C is less than or equal to Z, 523 00:25:53,990 --> 00:25:57,730 norm equals 97. 524 00:25:57,730 --> 00:26:01,645 Does that make sense to us? 525 00:26:01,645 --> 00:26:02,770 I'm a little confused, too. 526 00:26:02,770 --> 00:26:03,050 YULIIA ZHUKOVETS: A little confused. 527 00:26:03,050 --> 00:26:04,758 CARTER ZENKE: I'm a little confused, too. 528 00:26:04,758 --> 00:26:07,060 That's OK. 529 00:26:07,060 --> 00:26:10,360 I think what we're doing here, again, often 530 00:26:10,360 --> 00:26:12,970 you will be confused when students send code to you. 531 00:26:12,970 --> 00:26:15,460 I am often confused when students send code to me, OK? 532 00:26:15,460 --> 00:26:16,180 That's OK. 533 00:26:16,180 --> 00:26:18,040 So we'll walk through it step by step. 534 00:26:18,040 --> 00:26:23,500 I think they're asking is the character lowercase? 535 00:26:23,500 --> 00:26:24,307 Is it lowercase? 536 00:26:24,307 --> 00:26:26,140 That's the question they're asking up there? 537 00:26:26,140 --> 00:26:28,450 And if it is, if the character is lowercase, well, 538 00:26:28,450 --> 00:26:32,380 we'll set norm equal to 97. 539 00:26:32,380 --> 00:26:33,970 Unknown reasons yet, but we'll see. 540 00:26:33,970 --> 00:26:40,360 So now, otherwise, if the character is what? 541 00:26:40,360 --> 00:26:41,380 Uppercase, right? 542 00:26:41,380 --> 00:26:44,050 So if it's uppercase-- we saw the case if it's lowercase. 543 00:26:44,050 --> 00:26:48,070 But now the next one else if C greater than equal to A, 544 00:26:48,070 --> 00:26:50,410 that will be if it's uppercase. 545 00:26:50,410 --> 00:26:55,840 OK, if it's not lowercase or uppercase, what do we do? 546 00:26:55,840 --> 00:26:57,350 It's probably not a character. 547 00:26:57,350 --> 00:27:01,040 It's probably a number, like a one or a two or a three. 548 00:27:01,040 --> 00:27:05,390 We're testing to see if it is an alphabetical character or not. 549 00:27:05,390 --> 00:27:09,410 If it's not, if it's like a number, like one, or a special character, 550 00:27:09,410 --> 00:27:13,670 like an exclamation point or a period, we'll leave it alone, OK? 551 00:27:13,670 --> 00:27:17,660 So we'll only take and work with these alphabetical characters. 552 00:27:17,660 --> 00:27:23,840 OK, now I see here, we're taking our character and subtracting norm from it. 553 00:27:23,840 --> 00:27:24,920 Mm. 554 00:27:24,920 --> 00:27:28,160 So if I have a character, like A, what does it 555 00:27:28,160 --> 00:27:31,010 mean for me to subtract a number from it? 556 00:27:31,010 --> 00:27:36,770 It's a little bit interesting, but remember that characters in C 557 00:27:36,770 --> 00:27:39,020 are numbers, too, right? 558 00:27:39,020 --> 00:27:42,230 So A is represented by 65. 559 00:27:42,230 --> 00:27:44,870 Capital A, 65. 560 00:27:44,870 --> 00:27:46,310 Lowercase A is what? 561 00:27:46,310 --> 00:27:47,442 Do you remember? 562 00:27:47,442 --> 00:27:47,993 AUDIENCE: 97. 563 00:27:47,993 --> 00:27:49,160 CARTER ZENKE: Oh, very good. 564 00:27:49,160 --> 00:27:50,210 97. 565 00:27:50,210 --> 00:27:54,110 So it seems like what we're doing is taking our character 566 00:27:54,110 --> 00:27:56,240 and bringing it back down to zero. 567 00:27:56,240 --> 00:28:02,540 So if I had capital and I subtracted 65, I would get, in this case, zero. 568 00:28:02,540 --> 00:28:05,540 If I had B though, B is 66. 569 00:28:05,540 --> 00:28:08,300 What is capital B minus 65? 570 00:28:08,300 --> 00:28:10,083 Well, that's 1, OK? 571 00:28:10,083 --> 00:28:12,500 So it seems like we're bringing it down to a lower number. 572 00:28:12,500 --> 00:28:17,390 And the reason for this, I think, is that if I give you a character of Z 573 00:28:17,390 --> 00:28:19,850 and a key of one, what should I get? 574 00:28:19,850 --> 00:28:20,900 YULIIA ZHUKOVETS: A. 575 00:28:20,900 --> 00:28:24,830 CARTER ZENKE: A. So there's no letter after A. 576 00:28:24,830 --> 00:28:28,970 We have to go back around to the very first one, right? 577 00:28:28,970 --> 00:28:30,770 So I think this is helping us do that. 578 00:28:30,770 --> 00:28:35,090 Down below, we're going to add the key, modulo 26. 579 00:28:35,090 --> 00:28:37,790 This is also helping us not overstep the bounds, 580 00:28:37,790 --> 00:28:41,420 going past Z to some unknown letter that doesn't exist, right? 581 00:28:41,420 --> 00:28:42,590 We're going to go back to A. 582 00:28:42,590 --> 00:28:45,110 And then we're going to ask the question here. 583 00:28:45,110 --> 00:28:49,030 If C is greater than or equal to 26, let's subtract 26. 584 00:28:49,030 --> 00:28:50,780 I'm not sure why we're doing that friends. 585 00:28:50,780 --> 00:28:51,500 That's OK. 586 00:28:51,500 --> 00:28:54,250 And then we'll go down here, and we'll add some character to norm. 587 00:28:54,250 --> 00:28:56,652 And we'll return the character, and I think maybe we'd 588 00:28:56,652 --> 00:28:57,860 get back the right character. 589 00:28:57,860 --> 00:29:00,235 All right, so that was our overview of this example here. 590 00:29:00,235 --> 00:29:01,430 Let's compare them now. 591 00:29:01,430 --> 00:29:04,070 And we'll actually ask you to do this. 592 00:29:04,070 --> 00:29:07,130 YULIIA ZHUKOVETS: All right, so in the previous example, 593 00:29:07,130 --> 00:29:10,340 readibility, you saw me and Carter kind of go back and forth, 594 00:29:10,340 --> 00:29:14,510 discussing some differences between example 1 and example 2 595 00:29:14,510 --> 00:29:18,440 and maybe discussing what improvements one or the other could make. 596 00:29:18,440 --> 00:29:23,840 So what we want you to do now is turn left or right to your peer next to you. 597 00:29:23,840 --> 00:29:28,070 So maybe if you're on the edge, on this edge, turn left. 598 00:29:28,070 --> 00:29:30,030 If you're on that edge, also turn left. 599 00:29:30,030 --> 00:29:30,530 OK? 600 00:29:30,530 --> 00:29:37,040 Anyway, let's pair up and talk to each other in pairs. 601 00:29:37,040 --> 00:29:43,100 Which one of these codes is better, maybe what improvements one or the other 602 00:29:43,100 --> 00:29:43,850 can make? 603 00:29:43,850 --> 00:29:47,610 And then we'll come back all together and discuss again, all right? 604 00:29:47,610 --> 00:29:53,666 So let's turn next to each other, make pairs, and discuss the code, all right? 605 00:29:53,666 --> 00:29:56,654 [BACKGROUND CHATTER] 606 00:29:56,654 --> 00:31:37,248 607 00:31:37,248 --> 00:31:38,790 CARTER ZENKE: Oh, very good, friends. 608 00:31:38,790 --> 00:31:39,250 Thank you. 609 00:31:39,250 --> 00:31:39,750 Thank you. 610 00:31:39,750 --> 00:31:40,260 Thank you. 611 00:31:40,260 --> 00:31:43,320 OK, so I thought we'd do something a little unconventional 612 00:31:43,320 --> 00:31:51,720 here, which is we've now seen our two student submissions, yeah? 613 00:31:51,720 --> 00:31:55,470 We're going to cheer for the one we like the most, the one we 614 00:31:55,470 --> 00:31:57,330 think is the best, OK? 615 00:31:57,330 --> 00:32:01,152 So if you think this one was the best, please cheer for me. 616 00:32:01,152 --> 00:32:03,000 [CHEERING] 617 00:32:03,000 --> 00:32:03,715 OK, OK. 618 00:32:03,715 --> 00:32:04,590 That was pretty good. 619 00:32:04,590 --> 00:32:09,009 If you think this one was better, please cheer for me. 620 00:32:09,009 --> 00:32:10,310 [LAUGHTER] 621 00:32:10,310 --> 00:32:11,060 OK, one more time. 622 00:32:11,060 --> 00:32:13,102 If you think this one was the best, please cheer. 623 00:32:13,102 --> 00:32:14,036 [CHEERING] 624 00:32:14,036 --> 00:32:14,900 625 00:32:14,900 --> 00:32:16,940 If you think this one's the best, please cheer. 626 00:32:16,940 --> 00:32:17,900 [CHEERING] 627 00:32:17,900 --> 00:32:20,510 Oh, OK, OK. 628 00:32:20,510 --> 00:32:23,540 OK, so it seems like we think this one might have been better 629 00:32:23,540 --> 00:32:26,210 designed than the other one, OK? 630 00:32:26,210 --> 00:32:27,080 [CHEERING] 631 00:32:27,080 --> 00:32:31,190 All right, so let's now ask why? 632 00:32:31,190 --> 00:32:32,630 Why is this one better designed? 633 00:32:32,630 --> 00:32:35,240 634 00:32:35,240 --> 00:32:36,530 Yeah I'm hearing a few ideas. 635 00:32:36,530 --> 00:32:39,740 So let's go ahead and raise our hands and see. 636 00:32:39,740 --> 00:32:41,540 Let's go maybe back there Yuliia? 637 00:32:41,540 --> 00:32:44,949 [BACKGROUND CHATTER] 638 00:32:44,949 --> 00:32:53,230 639 00:32:53,230 --> 00:32:57,580 AUDIENCE: OK, I would like to tell why I chose 640 00:32:57,580 --> 00:33:01,840 the left side one better is because the student is 641 00:33:01,840 --> 00:33:04,870 make themselves clear by using common. 642 00:33:04,870 --> 00:33:11,650 So we can understand, line for line, what did they do. 643 00:33:11,650 --> 00:33:17,410 And also, they just use the character A, not the number. 644 00:33:17,410 --> 00:33:23,320 Because I remember from one of the lecture that maybe we somehow forget 645 00:33:23,320 --> 00:33:25,420 what is the number for A? 646 00:33:25,420 --> 00:33:28,390 What is the integer for lowercase A? 647 00:33:28,390 --> 00:33:31,360 Or is it a 66 or 65? 648 00:33:31,360 --> 00:33:39,430 So it's better to use just a lowercase A and uppercase A so will 649 00:33:39,430 --> 00:33:43,090 decrease the possibility to have a bug. 650 00:33:43,090 --> 00:33:47,500 And also, the last code of the right side 651 00:33:47,500 --> 00:33:54,740 is a little bit complicated that maybe we will forget to decrease the norm 652 00:33:54,740 --> 00:33:56,310 or add something to the key. 653 00:33:56,310 --> 00:34:03,320 So it will make the possibility to be a bug is bigger. 654 00:34:03,320 --> 00:34:05,690 So that's why I chose the left one. 655 00:34:05,690 --> 00:34:08,810 CARTER ZENKE: Yeah, thank you so much for sharing. 656 00:34:08,810 --> 00:34:11,750 So to summarize, I think you have a lot of great ideas. 657 00:34:11,750 --> 00:34:14,389 Some improvements over here is that the student used comments. 658 00:34:14,389 --> 00:34:16,010 Oh, thank goodness, right? 659 00:34:16,010 --> 00:34:18,290 Comments are always helpful for us, as teachers. 660 00:34:18,290 --> 00:34:24,469 They also seem to be using characters instead of numbers, which is helpful, 661 00:34:24,469 --> 00:34:28,670 as you said, because sometimes we forget what numbers equal what characters, 662 00:34:28,670 --> 00:34:29,507 right? 663 00:34:29,507 --> 00:34:31,340 And another point that I like that you said, 664 00:34:31,340 --> 00:34:33,469 too, is that this one is pretty complicated. 665 00:34:33,469 --> 00:34:40,190 It's pretty long, which it's OK, but it also can lead to more bugs, right? 666 00:34:40,190 --> 00:34:44,389 Now when we talk about bugs, we're really talking about correctness issues. 667 00:34:44,389 --> 00:34:46,500 Does it not work in some way? 668 00:34:46,500 --> 00:34:49,730 So if you have code that is not well designed, 669 00:34:49,730 --> 00:34:52,880 it can also lead to correctness issues, like bugs. 670 00:34:52,880 --> 00:34:53,750 OK? 671 00:34:53,750 --> 00:34:56,690 OK, let's see other ideas, too. 672 00:34:56,690 --> 00:34:59,570 Any more reasons to choose this one over that one? 673 00:34:59,570 --> 00:35:00,620 Yeah, let's go there. 674 00:35:00,620 --> 00:35:06,770 675 00:35:06,770 --> 00:35:12,950 AUDIENCE: In addition from the previous participant is that in the right code, 676 00:35:12,950 --> 00:35:22,550 you have to go through all the way down to return the C. When on the left code, 677 00:35:22,550 --> 00:35:27,410 if the first condition is true, you have to return without going 678 00:35:27,410 --> 00:35:30,418 through all the codes in the function. 679 00:35:30,418 --> 00:35:32,460 CARTER ZENKE: Yeah, I really like that idea, too. 680 00:35:32,460 --> 00:35:36,410 So it seems like on this left-hand side, we return from the function, 681 00:35:36,410 --> 00:35:38,360 we finish it much faster, right? 682 00:35:38,360 --> 00:35:43,130 So if this first condition is true, we return immediately. 683 00:35:43,130 --> 00:35:46,130 If it's not true, we check one more question 684 00:35:46,130 --> 00:35:48,080 and we return immediately, right? 685 00:35:48,080 --> 00:35:51,800 There's not a lot of code to go through, depending on the character we have. 686 00:35:51,800 --> 00:35:55,610 In this case, like you said, whatever character we have, 687 00:35:55,610 --> 00:35:58,040 we have to go all the way down through this code 688 00:35:58,040 --> 00:36:02,270 and finally return C. So a good observation there about why 689 00:36:02,270 --> 00:36:04,670 that one might be better designed. 690 00:36:04,670 --> 00:36:06,140 Good. 691 00:36:06,140 --> 00:36:07,190 Any more ideas? 692 00:36:07,190 --> 00:36:12,920 693 00:36:12,920 --> 00:36:13,625 OK, one more. 694 00:36:13,625 --> 00:36:20,240 695 00:36:20,240 --> 00:36:21,320 AUDIENCE: Thank you. 696 00:36:21,320 --> 00:36:25,460 We are laughing because yesterday, we are in back then. 697 00:36:25,460 --> 00:36:29,000 We are always hands up, but we are-- 698 00:36:29,000 --> 00:36:30,770 then today we are here. 699 00:36:30,770 --> 00:36:34,760 And no, no, this way. 700 00:36:34,760 --> 00:36:37,910 Thank you for the opportunity. 701 00:36:37,910 --> 00:36:44,420 OK, for the first one, I think it's better because it used isupper, islower. 702 00:36:44,420 --> 00:36:49,640 So it's much better than the right one, yeah. 703 00:36:49,640 --> 00:37:00,770 Then when we look at the code, the rotate is always repeat. 704 00:37:00,770 --> 00:37:05,720 repeat, again and again, so it takes time. 705 00:37:05,720 --> 00:37:09,173 And the code in the left side is better. 706 00:37:09,173 --> 00:37:10,340 CARTER ZENKE: Yeah, I agree. 707 00:37:10,340 --> 00:37:15,740 AUDIENCE: So we decide this is five and this is, because we are good teacher, 708 00:37:15,740 --> 00:37:18,200 four. 709 00:37:18,200 --> 00:37:19,821 CARTER ZENKE: Thank you for sharing. 710 00:37:19,821 --> 00:37:21,174 [LAUGHTER] 711 00:37:21,174 --> 00:37:22,980 712 00:37:22,980 --> 00:37:27,990 OK, so I like the ideas here. 713 00:37:27,990 --> 00:37:29,790 I like, in particular, that you mentioned 714 00:37:29,790 --> 00:37:36,330 this one uses helper functions, built-in functions, like isupper, islower. 715 00:37:36,330 --> 00:37:40,140 We're not remaking, reinventing the wheel, so to speak. 716 00:37:40,140 --> 00:37:43,830 We're, instead, using what C gives us in terms of the functions, 717 00:37:43,830 --> 00:37:47,940 as opposed to writing our own code to do exactly what R has already 718 00:37:47,940 --> 00:37:51,500 done by isupper and islower, OK? 719 00:37:51,500 --> 00:37:52,870 Good examples here. 720 00:37:52,870 --> 00:37:55,020 YULIIA ZHUKOVETS: Yeah, and so I think we already 721 00:37:55,020 --> 00:37:57,690 got some suggestion on the design score, and maybe we 722 00:37:57,690 --> 00:38:04,470 can actually take a vote on what people think this code should be awarded. 723 00:38:04,470 --> 00:38:10,690 So maybe if you think that the left code should be awarded five. 724 00:38:10,690 --> 00:38:12,015 Cheer now. 725 00:38:12,015 --> 00:38:13,230 [CHEERING] 726 00:38:13,230 --> 00:38:15,660 OK. 727 00:38:15,660 --> 00:38:19,650 And who thinks it should be four? 728 00:38:19,650 --> 00:38:21,030 Who thinks it should be-- 729 00:38:21,030 --> 00:38:24,370 OK, I hear some faint cheer. 730 00:38:24,370 --> 00:38:26,020 Who thinks it should be three? 731 00:38:26,020 --> 00:38:27,298 [APPLAUSE] 732 00:38:27,298 --> 00:38:28,150 733 00:38:28,150 --> 00:38:32,230 OK, so maybe we agree on somewhere between five and four, 734 00:38:32,230 --> 00:38:34,390 because this looks pretty good to me. 735 00:38:34,390 --> 00:38:38,860 But remember that we don't know what's going on inside of main. 736 00:38:38,860 --> 00:38:41,140 Main can be bad, right? 737 00:38:41,140 --> 00:38:46,300 So we need to look at the whole program to decide what score to award. 738 00:38:46,300 --> 00:38:50,960 And then, let's take a quick poll for the right example. 739 00:38:50,960 --> 00:38:53,610 So who thinks it should be awarded a five? 740 00:38:53,610 --> 00:38:56,170 741 00:38:56,170 --> 00:38:57,010 OK. 742 00:38:57,010 --> 00:38:58,090 Silent. 743 00:38:58,090 --> 00:38:58,660 No one. 744 00:38:58,660 --> 00:39:00,610 OK, not perfect code. 745 00:39:00,610 --> 00:39:02,890 What about a four? 746 00:39:02,890 --> 00:39:04,130 [LAUGHTER] 747 00:39:04,130 --> 00:39:04,630 748 00:39:04,630 --> 00:39:07,090 OK, OK, I hear some laughter. 749 00:39:07,090 --> 00:39:08,470 What about a three? 750 00:39:08,470 --> 00:39:10,240 [CHEERING] 751 00:39:10,240 --> 00:39:12,628 OK, and two? 752 00:39:12,628 --> 00:39:14,500 [FAINT APPLAUSE] 753 00:39:14,500 --> 00:39:17,110 And one? 754 00:39:17,110 --> 00:39:20,260 OK, I heard one clap. 755 00:39:20,260 --> 00:39:22,270 So I think we can agree here, friends. 756 00:39:22,270 --> 00:39:27,400 So maybe if you're feeling very generous, like these teachers over here, 757 00:39:27,400 --> 00:39:28,570 you can give a four. 758 00:39:28,570 --> 00:39:32,200 But really, it should be around a three, maybe even a two 759 00:39:32,200 --> 00:39:34,030 if you want to be a bad cop, right? 760 00:39:34,030 --> 00:39:38,290 So all right, so very good thoughts. 761 00:39:38,290 --> 00:39:39,520 Very good ideas. 762 00:39:39,520 --> 00:39:46,850 So now, we will turn things over to Carter so that he can talk about some 763 00:39:46,850 --> 00:39:49,507 of the things that I and him thought about before this session. 764 00:39:49,507 --> 00:39:52,340 CARTER ZENKE: So very similar to you all, we thought of a few things 765 00:39:52,340 --> 00:39:54,508 we would look for in this program here. 766 00:39:54,508 --> 00:39:57,800 To other people's points, we looked for if the student used built-in functions, 767 00:39:57,800 --> 00:39:59,450 like isupper and islower. 768 00:39:59,450 --> 00:40:03,890 We also asked did they use an efficient method for converting the character? 769 00:40:03,890 --> 00:40:07,370 To the point we had earlier from teachers here, here, we argue, 770 00:40:07,370 --> 00:40:08,330 is pretty efficient. 771 00:40:08,330 --> 00:40:09,620 The other one, not so much. 772 00:40:09,620 --> 00:40:09,860 OK? 773 00:40:09,860 --> 00:40:11,568 So just a high level overview of what you 774 00:40:11,568 --> 00:40:14,030 can look for in a program like Caesar. 775 00:40:14,030 --> 00:40:15,740 But now-- 776 00:40:15,740 --> 00:40:19,160 YULIIA ZHUKOVETS: Now we're actually going to turn things over to you, 777 00:40:19,160 --> 00:40:22,760 and you will do exact same process that Carter and I did 778 00:40:22,760 --> 00:40:26,390 on the board twice now but with a code example 779 00:40:26,390 --> 00:40:29,420 that you will have on the tables in your breakout rooms. 780 00:40:29,420 --> 00:40:32,900 And I will turn it to Carter to explain the specific instructions 781 00:40:32,900 --> 00:40:35,275 that you should do. 782 00:40:35,275 --> 00:40:38,150 CARTER ZENKE: OK, so in just a moment, we're going to leave the room, 783 00:40:38,150 --> 00:40:39,650 but not yet, OK? 784 00:40:39,650 --> 00:40:41,150 Not yet. 785 00:40:41,150 --> 00:40:44,550 When you leave the room, you'll go to the same table 786 00:40:44,550 --> 00:40:47,730 you did microteaching at yesterday. 787 00:40:47,730 --> 00:40:48,660 You had homework. 788 00:40:48,660 --> 00:40:50,280 Do you remember your number? 789 00:40:50,280 --> 00:40:52,200 OK, thank you. 790 00:40:52,200 --> 00:40:59,070 When you get to your table, you should find three of these papers, OK? 791 00:40:59,070 --> 00:41:02,250 Now this paper is very important. 792 00:41:02,250 --> 00:41:04,350 It has two sides. 793 00:41:04,350 --> 00:41:06,210 This is one side. 794 00:41:06,210 --> 00:41:08,430 This is the second side. 795 00:41:08,430 --> 00:41:10,110 First side. 796 00:41:10,110 --> 00:41:11,610 Second side. 797 00:41:11,610 --> 00:41:13,320 Paper is two-sided, OK? 798 00:41:13,320 --> 00:41:26,400 Yeah, now, in the top of it, you should see Sepia1.C. Sepia1.C on one side. 799 00:41:26,400 --> 00:41:34,710 On the other side, you'll see Sepia2.C. Do you remember Sepia? 800 00:41:34,710 --> 00:41:38,940 Sepia in the filter problem? 801 00:41:38,940 --> 00:41:42,030 Did you like the filter problem? 802 00:41:42,030 --> 00:41:43,080 OK, some mixed reviews. 803 00:41:43,080 --> 00:41:43,605 That's OK. 804 00:41:43,605 --> 00:41:48,500 805 00:41:48,500 --> 00:41:52,970 In the filter problem, you wrote a function to take an image 806 00:41:52,970 --> 00:41:55,520 and apply what we call a sepia filter. 807 00:41:55,520 --> 00:42:00,350 A sepia filter makes things look a little yellowish, if you remember. 808 00:42:00,350 --> 00:42:01,410 OK. 809 00:42:01,410 --> 00:42:06,620 So here, we actually have two real student submissions 810 00:42:06,620 --> 00:42:12,410 for the Sepia function, not the entire filter program, but the Sepia function. 811 00:42:12,410 --> 00:42:17,720 On the first side, Sepia1, you'll see one student, OK? 812 00:42:17,720 --> 00:42:20,030 On the second side-- remember, it's two-sided. 813 00:42:20,030 --> 00:42:23,400 This is the second student, OK? 814 00:42:23,400 --> 00:42:25,530 First student. 815 00:42:25,530 --> 00:42:26,700 Second student. 816 00:42:26,700 --> 00:42:27,780 What's this one? 817 00:42:27,780 --> 00:42:28,810 AUDIENCE: First student. 818 00:42:28,810 --> 00:42:30,060 CARTER ZENKE: What's this one? 819 00:42:30,060 --> 00:42:30,840 AUDIENCE: Second student. 820 00:42:30,840 --> 00:42:32,520 CARTER ZENKE: Two different students. 821 00:42:32,520 --> 00:42:35,100 OK, So here are your instructions. 822 00:42:35,100 --> 00:42:37,470 What you'll do is this. 823 00:42:37,470 --> 00:42:42,930 You will, on your own, individually, you will look at the paper, 824 00:42:42,930 --> 00:42:45,750 look at both submissions. 825 00:42:45,750 --> 00:42:48,420 Oh, in pairs, sorry, you'll be in pairs. 826 00:42:48,420 --> 00:42:52,650 Find somebody next to you and pair up and review it together, OK? 827 00:42:52,650 --> 00:42:58,020 You will then choose a design score, like we just did, one through five, 828 00:42:58,020 --> 00:43:00,210 for each student submission. 829 00:43:00,210 --> 00:43:01,080 OK? 830 00:43:01,080 --> 00:43:04,500 Now, remember, just like we did here, it's 831 00:43:04,500 --> 00:43:08,010 very important to walk through step by step 832 00:43:08,010 --> 00:43:10,710 and make sure you understand the code. 833 00:43:10,710 --> 00:43:14,160 If you don't understand it, you can ask somebody next to you 834 00:43:14,160 --> 00:43:15,690 and see if they understand it. 835 00:43:15,690 --> 00:43:18,603 And if they don't understand it, well, that's OK. 836 00:43:18,603 --> 00:43:19,770 You can talk through it, OK? 837 00:43:19,770 --> 00:43:21,450 You can try to understand. 838 00:43:21,450 --> 00:43:25,870 Talk in your group and figure out if you can understand it all together, OK? 839 00:43:25,870 --> 00:43:29,920 So for each of these submissions, you will do what? 840 00:43:29,920 --> 00:43:32,590 Look at it individually, and then give a-- 841 00:43:32,590 --> 00:43:33,940 AUDIENCE: Grade. 842 00:43:33,940 --> 00:43:36,550 CARTER ZENKE: Grade, a design score, one through five. 843 00:43:36,550 --> 00:43:40,930 All right, once you have your design score, one through five, 844 00:43:40,930 --> 00:43:42,640 you should discuss. 845 00:43:42,640 --> 00:43:46,900 You should discuss because maybe I think it is a five 846 00:43:46,900 --> 00:43:50,020 but my friend thinks it is a four. 847 00:43:50,020 --> 00:43:53,230 We have to agree, OK? 848 00:43:53,230 --> 00:43:54,040 Ideally. 849 00:43:54,040 --> 00:43:57,220 It's OK if you don't agree, but ideally, you want to get to a place 850 00:43:57,220 --> 00:43:59,560 that you agree, OK? 851 00:43:59,560 --> 00:44:06,640 And once you do, go ahead and do one step more. 852 00:44:06,640 --> 00:44:12,490 Go ahead and write on your paper with a pen some comments for the student. 853 00:44:12,490 --> 00:44:17,020 Mm, because it's not helpful if we just give a score. 854 00:44:17,020 --> 00:44:19,630 If I just write a five, what does that mean? 855 00:44:19,630 --> 00:44:22,210 If I just write a four, what does that mean, OK? 856 00:44:22,210 --> 00:44:28,510 So write some comments on the paper, and tell the student what they could improve 857 00:44:28,510 --> 00:44:32,620 or what they did a good job on, OK? 858 00:44:32,620 --> 00:44:37,600 So think of this as your own student who has submitted work to you, as a teacher. 859 00:44:37,600 --> 00:44:41,080 All right, one more time in Bahasa, Indonesia. 860 00:44:41,080 --> 00:44:43,360 This is what we'll do. 861 00:44:43,360 --> 00:44:47,620 Again, you'll find three of these papers on your tables. 862 00:44:47,620 --> 00:44:49,520 How many sides are there? 863 00:44:49,520 --> 00:44:50,190 AUDIENCE: Two. 864 00:44:50,190 --> 00:44:51,190 CARTER ZENKE: Thank you. 865 00:44:51,190 --> 00:44:54,670 There are two sides. 866 00:44:54,670 --> 00:44:58,870 For each side, you will give a design score, one through five, 867 00:44:58,870 --> 00:45:02,830 after reading it and understanding it. 868 00:45:02,830 --> 00:45:05,620 After you give a design score, you will try 869 00:45:05,620 --> 00:45:09,730 to agree with your entire group for each problem. 870 00:45:09,730 --> 00:45:16,090 And then you will write some comments for the student on each side, OK? 871 00:45:16,090 --> 00:45:19,900 What questions do we have? 872 00:45:19,900 --> 00:45:21,400 Make sense? 873 00:45:21,400 --> 00:45:23,110 Does it make sense? 874 00:45:23,110 --> 00:45:24,070 OK, that's good. 875 00:45:24,070 --> 00:45:28,090 So we're going to follow our algorithm here once, again. 876 00:45:28,090 --> 00:45:30,550 Now here is how our algorithm will go. 877 00:45:30,550 --> 00:45:33,880 If you are in groups 1 through 10, please raise your hand. 878 00:45:33,880 --> 00:45:35,950 Groups 1 through 10, so good to see you again. 879 00:45:35,950 --> 00:45:37,075 Could you get ready for me? 880 00:45:37,075 --> 00:45:38,170 Could you stand up? 881 00:45:38,170 --> 00:45:41,980 YULIIA ZHUKOVETS: Let's just take five minutes to recap what we just did. 882 00:45:41,980 --> 00:45:46,990 So we asked you to discuss the code, assign it a design score, 883 00:45:46,990 --> 00:45:49,570 and maybe write some comments with improvements. 884 00:45:49,570 --> 00:45:54,250 So I thought we can take this time to do a quick poll on what 885 00:45:54,250 --> 00:45:56,590 design score each group awarded. 886 00:45:56,590 --> 00:46:04,420 So first let's take a look at Sepia1, Sepia1 with some IF statements, 887 00:46:04,420 --> 00:46:08,770 so the longer code, the one was on the first side of the page. 888 00:46:08,770 --> 00:46:14,170 And so if your group awarded a design score of one, cheer now. 889 00:46:14,170 --> 00:46:15,670 One. 890 00:46:15,670 --> 00:46:19,910 If your design score was two, if you're-- 891 00:46:19,910 --> 00:46:21,770 OK, some pain sounds. 892 00:46:21,770 --> 00:46:23,930 If your design score was three. 893 00:46:23,930 --> 00:46:24,620 [APPLAUSE] 894 00:46:24,620 --> 00:46:26,300 OK. 895 00:46:26,300 --> 00:46:28,550 And if your design was four. 896 00:46:28,550 --> 00:46:29,180 [APPLAUSE] 897 00:46:29,180 --> 00:46:29,680 Woo. 898 00:46:29,680 --> 00:46:32,210 899 00:46:32,210 --> 00:46:35,390 All right, and what about five? 900 00:46:35,390 --> 00:46:36,050 OK. 901 00:46:36,050 --> 00:46:38,820 [LAUGHS] All right. 902 00:46:38,820 --> 00:46:39,320 OK. 903 00:46:39,320 --> 00:46:42,470 So I think we agree on somewhere between 3 and 4. 904 00:46:42,470 --> 00:46:45,470 So now let's take a look at Sepia2. 905 00:46:45,470 --> 00:46:50,120 So to me, this code looks a little bit more simpler and succinct, 906 00:46:50,120 --> 00:46:52,940 but I want to hear what you, friends, think. 907 00:46:52,940 --> 00:46:58,760 So if your team awarded this program, Sepia2, one, cheer now. 908 00:46:58,760 --> 00:47:00,230 One. 909 00:47:00,230 --> 00:47:01,320 What about two? 910 00:47:01,320 --> 00:47:04,265 911 00:47:04,265 --> 00:47:08,900 [LAUGHS] What about three? 912 00:47:08,900 --> 00:47:09,620 OK. 913 00:47:09,620 --> 00:47:10,880 What about four? 914 00:47:10,880 --> 00:47:12,080 [APPLAUSE] 915 00:47:12,080 --> 00:47:12,740 OK. 916 00:47:12,740 --> 00:47:14,120 And what about five? 917 00:47:14,120 --> 00:47:15,200 [CHEERING] 918 00:47:15,200 --> 00:47:17,970 919 00:47:17,970 --> 00:47:23,400 OK, it seems like folks thought that Sepia2 was a little bit better design, 920 00:47:23,400 --> 00:47:25,590 and I think I would agree with that. 921 00:47:25,590 --> 00:47:30,600 What I really like about this program is that it looks, first 922 00:47:30,600 --> 00:47:32,640 of all, shorter to a human eye. 923 00:47:32,640 --> 00:47:38,850 Second of all, it makes use of some built-in C functions, right? 924 00:47:38,850 --> 00:47:41,100 So it uses round and fmin. 925 00:47:41,100 --> 00:47:44,190 And I don't really see any repetitions, right? 926 00:47:44,190 --> 00:47:46,980 The code is pretty simple and algorithmical. 927 00:47:46,980 --> 00:47:51,810 But if we go back to Sepia1, one thing that really stood out to me 928 00:47:51,810 --> 00:47:54,300 was these IF statements, right? 929 00:47:54,300 --> 00:47:57,150 So to me, it looks like the student might 930 00:47:57,150 --> 00:48:01,770 have just copy pasted it three times and really, 931 00:48:01,770 --> 00:48:05,100 if we find ourselves copy pasting things, 932 00:48:05,100 --> 00:48:08,070 we should probably use a helper function, OK? 933 00:48:08,070 --> 00:48:09,155 Do we agree on that? 934 00:48:09,155 --> 00:48:09,780 AUDIENCE: Yeah. 935 00:48:09,780 --> 00:48:10,920 YULIIA ZHUKOVETS: Yeah. 936 00:48:10,920 --> 00:48:11,610 OK. 937 00:48:11,610 --> 00:48:20,125 So one last time, if you think that Sepia1 is better designed, shout now. 938 00:48:20,125 --> 00:48:21,610 [APPLAUSE] 939 00:48:21,610 --> 00:48:25,180 OK, and if you think Sepia2 is better design-- 940 00:48:25,180 --> 00:48:26,653 [CHEERING] 941 00:48:26,653 --> 00:48:28,620 942 00:48:28,620 --> 00:48:30,480 All right, great job, friends. 943 00:48:30,480 --> 00:48:35,370 And as you've seen today, it's really a lot about comparison and contrasting. 944 00:48:35,370 --> 00:48:41,040 So as you find yourself grading more and more problem sets and programs 945 00:48:41,040 --> 00:48:45,750 like this, you'll find yourself being able to award more consistent design 946 00:48:45,750 --> 00:48:49,830 scores and leaving some good comments for your students. 947 00:48:49,830 --> 00:48:54,110 But for now, this was a session on grading and feedback. 948 00:48:54,110 --> 00:48:55,000