1 00:00:00,005 --> 00:00:09,670 I hope you're already beginning to see some of the power of working with a 2 00:00:09,670 --> 00:00:14,880 systematic design process. One piece of that is that you always know 3 00:00:14,880 --> 00:00:17,700 what to do next. There's always the next step of the 4 00:00:17,700 --> 00:00:20,890 recipe. And that step of the recipe tells you 5 00:00:20,890 --> 00:00:25,150 what kind of thing you need to write and where you should be looking to figure out 6 00:00:25,150 --> 00:00:28,210 how to write it. So when it's time to write the examples, 7 00:00:28,210 --> 00:00:32,260 you know that you can look at the signature, and the purpose, to help you 8 00:00:32,260 --> 00:00:37,540 figure out what the examples need to be. You've also seen the benefit of producing 9 00:00:37,540 --> 00:00:41,350 uniformly structured code. Code that's easy for other programmers to 10 00:00:41,350 --> 00:00:44,740 read, and code that has an appropriate number of tests. 11 00:00:46,020 --> 00:00:49,460 But in this next part, you're going to see the power of systematic design really 12 00:00:49,460 --> 00:00:53,440 start to step up. What's going to happen is that because 13 00:00:53,440 --> 00:00:58,040 the design method itself, in other words the metadesign, in some sense. 14 00:00:58,040 --> 00:01:03,053 Because the design method itself is structured so that the How to Define 15 00:01:03,053 --> 00:01:09,150 Functions recipe is orthogonal, which is kind of a $10 word for, means mostly 16 00:01:09,150 --> 00:01:12,420 independent. Because the functions recipe and the data 17 00:01:12,420 --> 00:01:18,960 recipe are orthogonal, it means that as we learn more forms of data, the 18 00:01:18,960 --> 00:01:23,410 functions recipe is going to continue to work unchanged, or mostly unchanged, with 19 00:01:23,410 --> 00:01:26,660 those forms of data. So now we're going to begin to cover the 20 00:01:26,660 --> 00:01:31,340 ground a lot more quickly, because of this property of the way the recipes are 21 00:01:31,340 --> 00:01:35,060 designed. In week one, and particularly at the end 22 00:01:35,060 --> 00:01:40,870 of week one, we learned about primitive data, including types like String, 23 00:01:40,870 --> 00:01:44,890 Number, and Image. And we learned the How to Design Function 24 00:01:44,890 --> 00:01:49,790 recipe, and we used it to design functions like double, which consumed a 25 00:01:49,790 --> 00:01:53,931 number, and yell, which consumed a string, and area, which consumed. 26 00:01:53,931 --> 00:01:57,637 A number, and image-area which consumed an image. 27 00:01:57,637 --> 00:02:01,600 And what started to happen this week is we've started to learn about other forms 28 00:02:01,600 --> 00:02:04,592 of data. And in particular we've learned about 29 00:02:04,592 --> 00:02:08,350 non-primitive data, data where there's a type that we design with the How to 30 00:02:08,350 --> 00:02:12,350 Design Data definitions recipe. And what we did in the last two videos 31 00:02:12,350 --> 00:02:17,990 was we learned about atomic non-primitive data, and we designed the type CityName, 32 00:02:17,990 --> 00:02:22,430 and then we designed the best function that consumed a city name. 33 00:02:22,430 --> 00:02:27,760 And earlier in the week you actually saw a preview of a form of data called 34 00:02:27,760 --> 00:02:31,070 enumerations which we haven't explicitly covered yet. 35 00:02:31,070 --> 00:02:34,120 We'll do that shortly. But you saw another type called Traffic 36 00:02:34,120 --> 00:02:40,050 Light Color, and a function, next-color. And what's going to happen the rest of 37 00:02:40,050 --> 00:02:45,050 this week, is we're going to learn about some other forms of data including 38 00:02:45,050 --> 00:02:50,360 intervals, enumerations, itemizations, and a special form called distinct. 39 00:02:51,910 --> 00:02:57,600 And we'll see examples of those types. And you'll be able to design functions 40 00:02:57,600 --> 00:03:02,460 that operate on them. As I said before the HtDF recipe is 41 00:03:02,460 --> 00:03:08,240 largely orthogonal to the form of data. So HtDF works the same way with different 42 00:03:08,240 --> 00:03:11,110 forms of data. And what that means in this week is we're 43 00:03:11,110 --> 00:03:16,964 going to focus most of the lecture time on designing different kinds of data 44 00:03:16,964 --> 00:03:19,430 definitions. And we're going to have to spend much 45 00:03:19,430 --> 00:03:24,310 less time on designing functions that consume that data. 46 00:03:25,960 --> 00:03:29,440 In some sense what's happening is we did this little piece of the y-axis, How to 47 00:03:29,440 --> 00:03:33,710 Design Functions, and now we're working out the x-axis. 48 00:03:33,710 --> 00:03:38,720 And all of this space in the middle, the cross product of the two axes comes very 49 00:03:38,720 --> 00:03:42,920 cheaply. We won't have to spend much lecture time 50 00:03:42,920 --> 00:03:46,810 talking about these kinds of functions. Instead, we spend most of the lecture 51 00:03:46,810 --> 00:03:50,920 time talking about forms of data. And designing these kinds of functions 52 00:03:50,920 --> 00:03:54,290 comes almost for free. And what's great is the power of having a 53 00:03:54,290 --> 00:03:58,590 design method in which the individual recipes are orthogonal to the form of 54 00:03:58,590 --> 00:04:04,330 data is only going to grow from there. Next week, we're mostly going to focus on 55 00:04:04,330 --> 00:04:09,530 two things. One new form of data, compound data, and 56 00:04:09,530 --> 00:04:14,735 also a recipe that helps us design interactive programs, like games, and 57 00:04:14,735 --> 00:04:18,820 animations, and things like that. And again, because of this orthogonality, 58 00:04:18,820 --> 00:04:26,385 most of the lecture time will be on compound data, and on a How to Design 59 00:04:26,385 --> 00:04:30,550 Worlds recipe. And we'll do some examples in the cross 60 00:04:30,550 --> 00:04:35,490 product, some examples in the green box. But we won't have to do all of them in 61 00:04:35,490 --> 00:04:40,110 lecture, because once you know how to design worlds and once you know compound 62 00:04:40,110 --> 00:04:45,220 data, you can do anything in the blue, red, or green boxes. 63 00:04:46,520 --> 00:04:51,310 Beyond that, when we do lists and trees, lists and trees are complicated 64 00:04:51,310 --> 00:04:54,240 structures. But because of this orthogonality, again, 65 00:04:54,240 --> 00:04:57,690 they're going to be much easier to learn in this course than they are in some 66 00:04:57,690 --> 00:05:02,080 other courses. Orthogonality is always great in design 67 00:05:02,080 --> 00:05:05,590 when you can get it. Here you've got orthogonality in the 68 00:05:05,590 --> 00:05:10,671 design of the actual design method, and it's giving us some wonderful properties 69 00:05:10,671 --> 00:05:14,476 here. We can learn HtDF, and HtDW, and we can 70 00:05:14,476 --> 00:05:19,850 learn forms of data, and we get the cross product for free. 71 00:05:19,850 --> 00:05:23,470 That's going to be a big benefit in terms of using this method. 72 00:05:23,470 --> 00:05:27,575 And later on in the course we'll see some other examples of where we work 73 00:05:27,575 --> 00:05:31,300 orthogonality into our own designs and get some similar benefits.