1 00:00:03,030 --> 00:00:06,831 *34C3 preroll music* 2 00:00:14,960 --> 00:00:23,481 Angel: Our next speaker is Mike Sperber. He's CEO, CTO at active group, co- 3 00:00:23,481 --> 00:00:27,900 organizer of the annual BOB conference, developer conference, and expert in 4 00:00:27,900 --> 00:00:32,730 functional programming. He has about 20 years of experience in teaching 5 00:00:32,730 --> 00:00:38,500 programming in high schools, universities and other contexts. In his talk Mike will 6 00:00:38,500 --> 00:00:44,390 share his experiences and gives us an idea on how changes and culture methods and 7 00:00:44,390 --> 00:00:51,079 tools in programming might contribute to the future of software and software of the 8 00:00:51,079 --> 00:00:56,159 future. Please enjoy the talk by Mike. The stage is yours. 9 00:00:56,159 --> 00:01:01,589 Speaker: Thank you very much. *Applause* 10 00:01:01,589 --> 00:01:04,809 And did she say 20 years? I'm older than that. 11 00:01:04,809 --> 00:01:10,300 So I appreciate you staying up this late. Ah, so I'm all grown up now, so talking 12 00:01:10,300 --> 00:01:14,520 about growing up: so I graduated at some point and got a degree in computer 13 00:01:14,520 --> 00:01:19,020 science, I got a PhD many years ago and now I'm CEO of a software company that 14 00:01:19,020 --> 00:01:23,609 carries some actual responsibility. But as I was preparing this talk 15 00:01:23,609 --> 00:01:24,909 I thought back to the 16 00:01:24,909 --> 00:01:30,159 past and it happened to be the year in 1983 when I started hacking and, ah, well 17 00:01:30,159 --> 00:01:36,310 I wasn't there. But it must have been the year of 1C3 right? Ah, and so if you read 18 00:01:36,310 --> 00:01:40,119 what was written about the computing revolution that was to come in the early 19 00:01:40,119 --> 00:01:45,009 1980s. A lot of what we're having arguments about today was already there. 20 00:01:45,009 --> 00:01:49,409 Computer security, data governance, surveillance. All these things were 21 00:01:49,409 --> 00:01:53,640 already on the radar of the media back then. But a couple of things were 22 00:01:53,640 --> 00:01:58,310 different, also. So here's a major German news magazine that had an article on 23 00:01:58,310 --> 00:02:03,161 computers in children's rooms. And not everybody had a computer back then. So if 24 00:02:03,161 --> 00:02:06,930 you were a kid like me who was interested in learning about computers and didn't 25 00:02:06,930 --> 00:02:10,330 have one at home. There was a place you could go to, which was the local 26 00:02:10,330 --> 00:02:14,370 department store. And, well, the picture isn't very clear, but that's actually a 27 00:02:14,370 --> 00:02:18,812 local department store that had rows and rows of home computers set up. And 28 00:02:18,812 --> 00:02:25,140 plugged in and ready to go for children to to play with. And so back then, there 29 00:02:25,140 --> 00:02:28,910 were, you don't remember this, but there were many different kinds of home 30 00:02:28,910 --> 00:02:33,320 computers there was no internet. There was very little in the way of readily 31 00:02:33,320 --> 00:02:37,150 available literature on how to program computers. So we all had to figure it out 32 00:02:37,150 --> 00:02:41,740 by try, by trial and error. And we didn't really have a good methodology of how to 33 00:02:41,740 --> 00:02:46,880 program computers. Now, fast forward, a couple of years: I looked unbelievably 34 00:02:46,880 --> 00:02:50,880 geeky in 1986. By then I had my own computer and that must have been even the 35 00:02:50,880 --> 00:02:57,690 second or third one that I had. And you know by the time I was an exchange student 36 00:02:57,690 --> 00:03:01,730 in the United States. They made me president of the computer club. You can 37 00:03:01,730 --> 00:03:06,000 see another picture of me right there. And that was my first experience of teaching a 38 00:03:06,000 --> 00:03:10,850 formal course. So that was in 1988 and that was the end of that year. So that 39 00:03:10,850 --> 00:03:15,765 means I taught my first computer science course thirty years ago. 40 00:03:15,765 --> 00:03:17,920 And I then ended 41 00:03:17,920 --> 00:03:22,360 up designing the intro programming course at the University of Tübingen and taught 42 00:03:22,360 --> 00:03:27,760 that over more than 10 years. I taught programming to humanities majors. I've 43 00:03:27,760 --> 00:03:32,400 done a lot of professional training by now and, well, if you're sort of a compulsive 44 00:03:32,400 --> 00:03:37,030 educator like I am, everybody around you suffers, right? Your co-workers, your 45 00:03:37,030 --> 00:03:41,610 friends, my children certainly, my relatives. A lot of them have had to 46 00:03:41,610 --> 00:03:47,150 endure, you know, one or other kinds of programming course from me. So back then, 47 00:03:47,150 --> 00:03:52,080 as we were trying to figure out how to hack computers, you know as there was very 48 00:03:52,080 --> 00:03:56,160 little available literature, we also looked for role models and here's an early 49 00:03:56,160 --> 00:04:00,170 role models from the 80s, a man named John Draper, better known as Captain Crunch 50 00:04:00,170 --> 00:04:04,270 because he used the whistle that he found in a cereal box to manipulate the US phone 51 00:04:04,270 --> 00:04:09,400 system and then actually went to prison for it. So but John Draper also is not as 52 00:04:09,400 --> 00:04:13,250 well known for actually writing software and he produced one of the early word 53 00:04:13,250 --> 00:04:17,531 processors that was available on personal computers called Easy Rider, that I 54 00:04:17,531 --> 00:04:23,350 actually used, and there were reports on on the prolific programming style that 55 00:04:23,350 --> 00:04:27,440 Draper practiced, so I don't know if you can read this, the joke is if Draper were 56 00:04:27,440 --> 00:04:31,400 writing math routines for addition he came up with the answer two plus two equals 57 00:04:31,400 --> 00:04:35,460 five, he would put a clause in the program, if two plus three equals five 58 00:04:35,460 --> 00:04:39,890 then that answer is four and that's generally the way he writes programs. 59 00:04:39,890 --> 00:04:45,230 Who's seen programs like this, where yeah, a lot of you right, where somebody adds 60 00:04:45,230 --> 00:04:50,820 clause after clause of special cases until you know, so the special cases encountered 61 00:04:50,820 --> 00:04:57,520 in the wild are all covered. So, of course, you know it in 1983 we all figured 62 00:04:57,520 --> 00:05:03,900 out ourselves but people by 1985 the Hacker Bible came out and already worried 63 00:05:03,900 --> 00:05:08,340 about how we would educate children about computers in the future and so there was 64 00:05:08,340 --> 00:05:14,080 an article about computers in school and I'm gonna zoom in a little bit and as I'm 65 00:05:14,080 --> 00:05:18,710 sure I'm sure you've been involved in many discussions on how to teach programming to 66 00:05:18,710 --> 00:05:23,160 beginners and as always that discussion focuses on the programming language that's 67 00:05:23,160 --> 00:05:26,880 being used. Back then, you know the popular languages were somewhat different 68 00:05:26,880 --> 00:05:32,500 from today. There was BASIC, Pascal. BASIC had that reputation of producing spaghetti 69 00:05:32,500 --> 00:05:38,000 code, Forth is mentioned, LOGO is mentioned and C is mentioned there. And a 70 00:05:38,000 --> 00:05:41,620 prominent, back then a prominent, professor of computer science in Germany 71 00:05:41,620 --> 00:05:46,510 said well as long as you don't program in BASIC you'll be fine. Right, the pure fact 72 00:05:46,510 --> 00:05:51,665 of not programming BASIC is gonna keep you from writing spaghetti code. And as we now 73 00:05:51,665 --> 00:05:55,580 know that isn't really true and I'm sure most of you have seen really crappy and 74 00:05:55,580 --> 00:06:00,230 spaghetti code in production but the bullets kind of keep hitting closer, 75 00:06:00,230 --> 00:06:04,680 right? I think this must have been two years ago when a vulnerability in popular 76 00:06:04,680 --> 00:06:08,790 IoT devices essentially brought down the internet because they were all assembled 77 00:06:08,790 --> 00:06:13,639 into a botnet that brought down a popular DNS provider and github went down, I think 78 00:06:13,639 --> 00:06:17,790 that's what most of you probably remember. There was HeartBleed that I'm sure a lot 79 00:06:17,790 --> 00:06:21,740 of you remember, due to a vulnerability a buffer overflow because in 80 00:06:21,740 --> 00:06:26,940 OpenSSL, which was written in C, there was Equifax which divulged a lot of social 81 00:06:26,940 --> 00:06:30,770 security numbers because of a bug in Struts, in the web framework that they 82 00:06:30,770 --> 00:06:35,860 used and more interestingly, I think for, for students of the past there was the 83 00:06:35,860 --> 00:06:40,200 CloudBleed vulnerability which would divulge secret passwords and account 84 00:06:40,200 --> 00:06:44,540 information on webpages just as part of the web cache. You wouldn't even have to 85 00:06:44,540 --> 00:06:49,650 ask it, you know, secret questions as you would have to ask CloudBleed and that was 86 00:06:49,650 --> 00:06:53,551 oddly reminiscent of something well none of you remembers unless you're as old as I 87 00:06:53,551 --> 00:06:57,990 am which was the BTX hack which was one of the founding stones I think of the 88 00:06:57,990 --> 00:07:03,830 Chaos Computer Club, where people were able to make the computer of a bank, that 89 00:07:03,830 --> 00:07:08,911 was attached to BTX, divulge passwords. Essentially a memory dump that will 90 00:07:08,911 --> 00:07:13,850 contain passwords and then transfer a lot of money from that bank to them and so 91 00:07:13,850 --> 00:07:21,150 that felt a lot. So the present in many ways it feels a lot like the past did and 92 00:07:21,150 --> 00:07:25,160 you would think there would be some kind of progress and I think I was as guilty of 93 00:07:25,160 --> 00:07:30,650 that as anybody so in 1986 I wrote my first book and as many books now and 94 00:07:30,650 --> 00:07:34,430 then it focused on a specific programming language, of course I picked like the 95 00:07:34,430 --> 00:07:38,470 worst programming language in hindsight, that I ever could have picked on that it's 96 00:07:38,470 --> 00:07:43,220 responsible for a lot of the vulnerabilities that we see today. So, but 97 00:07:43,220 --> 00:07:48,889 again, you know it was at least, I can say it was in 1986, so it was a long time ago. 98 00:07:48,889 --> 00:07:54,040 A long time ago. So you would think things have changed. So some of you may have been 99 00:07:54,040 --> 00:07:59,740 at a talk earlier today about the Bob system for teaching for teaching young 100 00:07:59,740 --> 00:08:05,449 kids on how to program and Bob prides itself on teaching programming in exactly 101 00:08:05,449 --> 00:08:10,160 the same way as computer experts would program, but it would use an approach used 102 00:08:10,160 --> 00:08:15,990 based on gamification to teach students, right? And so you know in 1986 we were 103 00:08:15,990 --> 00:08:20,740 programming in C, so Bob now is programmed in C++, so something has happened since 104 00:08:20,740 --> 00:08:29,040 then. And you can look at a lot of pages, web pages and systems for teaching 105 00:08:29,040 --> 00:08:33,459 beginners on how to program. Here's a prominent page supported by a lot of major 106 00:08:33,459 --> 00:08:38,939 organizations called start coding de from this year and you can see again that a lot 107 00:08:38,939 --> 00:08:42,769 of the stuff that it teaches where first of all is focused on particular 108 00:08:42,769 --> 00:08:47,170 programming languages, on Scratch and Python and Processing. So there's right, 109 00:08:47,170 --> 00:08:51,189 there's three programming languages mentioned there and if you can read the 110 00:08:51,189 --> 00:08:55,110 fine print and if you can read German it says "spielerische Herangehensweise", 111 00:08:55,110 --> 00:09:00,240 which means that there is a that there's a fun based, a playful approach to teaching 112 00:09:00,240 --> 00:09:04,809 how to program and that's common to a lot of things. So if you go to a kids space 113 00:09:04,809 --> 00:09:09,810 you will find a section there called "Jugend hackt" and you can see that it 114 00:09:09,810 --> 00:09:13,769 also takes a very playful approach to teaching and if you look at its material a 115 00:09:13,769 --> 00:09:19,431 lot of it also features particular programming languages. And there's, if you 116 00:09:19,431 --> 00:09:24,660 look you, will find that there's a curious absence of methodology on these, on all of 117 00:09:24,660 --> 00:09:32,569 these pages, and I think part of the reason is that, I think, if you teach 118 00:09:32,569 --> 00:09:37,430 programming, you can easily get the feeling that it's very easy, right? I mean 119 00:09:37,430 --> 00:09:41,379 you can teach people to write very trivial programs that will blink an LED or do 120 00:09:41,379 --> 00:09:45,720 something like that and you know light, the lights, the eyes of your students they 121 00:09:45,720 --> 00:09:50,179 will just light up and they will just love what you teach them, if it's trivial. If 122 00:09:50,179 --> 00:09:53,959 it's not so trivial, so I like functional programming, which is sometimes not so 123 00:09:53,959 --> 00:09:58,470 easy, but in any given group that's large enough you will find a few Sheldons that 124 00:09:58,470 --> 00:10:02,410 will just eat up everything that you teach them and they will come to you. And they 125 00:10:02,410 --> 00:10:06,115 will say "oh I just love", whatever it is, the lambda calculus, functional 126 00:10:06,115 --> 00:10:09,769 programming, whatever and you know, if you've been at it for thirty years you 127 00:10:09,769 --> 00:10:13,489 notice that it doesn't really matter what you teach you will always find a few 128 00:10:13,489 --> 00:10:21,920 Sheldons that will tell you that they love what you teach them. And so after a 129 00:10:21,920 --> 00:10:26,339 while you though, you realize that, well there's a few Sheldons but then there's 130 00:10:26,339 --> 00:10:32,179 also a lot of students in your class who are not Sheldons. And as you're chugging 131 00:10:32,179 --> 00:10:36,449 along on your teaching train and you look out the back you suddenly realize that 132 00:10:36,449 --> 00:10:40,548 you've left a lot of students behind. They might still like what you're doing but you 133 00:10:40,548 --> 00:10:46,009 really haven't taught them any, you know, significant abilities and so over the 134 00:10:46,009 --> 00:10:49,999 years I've had a lot of opportunity to think why that is. Why is teaching so hard 135 00:10:49,999 --> 00:10:54,869 and why is it often unsuccessful? And one of the reasons is, that I think if you 136 00:10:54,869 --> 00:10:59,619 pick up any almost any book on programming or open any webpage that tries to teach 137 00:10:59,619 --> 00:11:05,980 your programming, it uses an approach that I call teaching by example. So here's a 138 00:11:05,980 --> 00:11:11,019 book by a computer science professor, came out this year, and you know "Learn Java 139 00:11:11,019 --> 00:11:14,589 the easy way" and the easy way is in the second chapter right after the 140 00:11:14,589 --> 00:11:20,069 introduction, we do an example, right? And there's a concrete listing of a concrete 141 00:11:20,069 --> 00:11:25,779 program and the text essentially is just a commentary for that program and then the 142 00:11:25,779 --> 00:11:31,480 expectation is, that from the example that you've seen, that exposes various elements 143 00:11:31,480 --> 00:11:35,819 of the programming language, like while loops and System.out.println and whatever, 144 00:11:35,819 --> 00:11:40,300 you will, I think by osmosis, or some other magical mechanism absorb the ability 145 00:11:40,300 --> 00:11:45,500 to apply the techniques to new problems and my experience has been that that often 146 00:11:45,500 --> 00:11:51,000 does not work for the great mass of students were not Sheldons. 147 00:11:51,000 --> 00:11:56,369 I thought back to the great teachers that I've had, maybe not in computer science 148 00:11:56,369 --> 00:12:00,120 but you know what methods were they using and then when I thought about it, I 149 00:12:00,120 --> 00:12:04,779 realized that they were using methods that were completely different. So here's a 150 00:12:04,779 --> 00:12:10,879 picture of my eleventh grade English teacher, Anne Carvalho, in 1987. That was, 151 00:12:10,879 --> 00:12:15,199 as I was an exchange student in the US and at the beginning of the class she handed 152 00:12:15,199 --> 00:12:19,149 out a piece of paper, well you can't really see it, so I'm gonna zoom in, that 153 00:12:19,149 --> 00:12:24,089 said you know, how to write a composition in this class, right? And so composition 154 00:12:24,089 --> 00:12:29,119 of this class, well here's the second section, is the body, right. The body is 155 00:12:29,119 --> 00:12:33,050 three paragraphs with each paragraph developing one of the areas of the thesis, 156 00:12:33,050 --> 00:12:37,259 first area scope, usually one paragraph, transition topic sentence. If you look at 157 00:12:37,259 --> 00:12:42,540 this, this is a very precise outline that explains the function of just about every 158 00:12:42,540 --> 00:12:47,040 single sentence in your composition. So it's a very rigid harness, if you will, 159 00:12:47,040 --> 00:12:51,609 for a composition and you know, coming from Germany, Germans are generally very, 160 00:12:51,609 --> 00:12:55,679 they don't accept a lot of power distance and they don't they authority that much, 161 00:12:55,679 --> 00:13:01,889 you know, I was an instant rebel to this concept and it took me most of the year to 162 00:13:01,889 --> 00:13:06,430 really accept that it was a great way to learn how to, to learn one good and 163 00:13:06,430 --> 00:13:10,980 working way of writing a composition and then I could branch out from there and 164 00:13:10,980 --> 00:13:16,170 develop other working ways of composition so this is a methodology for doing 165 00:13:16,170 --> 00:13:20,260 something that is extremely useful and powerful when you teach. 166 00:13:20,260 --> 00:13:23,420 And you might say, well we have methodologies like that in computer 167 00:13:23,420 --> 00:13:27,059 science and in programming as well, you know we've been doing object-oriented 168 00:13:27,059 --> 00:13:32,509 programming which is supposed to be very principled. I've seen a lot of crappy 169 00:13:32,509 --> 00:13:38,199 object-oriented code as well. I don't know about you. So you know, an object oriented 170 00:13:38,199 --> 00:13:43,180 programming well it has encapsulated state, it has polymorphism and it has 171 00:13:43,180 --> 00:13:47,579 inheritance. Inheritance is particularly bad because there's so many different uses 172 00:13:47,579 --> 00:13:52,230 of inheritance and typically your programming language will only have one 173 00:13:52,230 --> 00:13:56,779 mechanism and so people often get it wrong and they do inheritance the wrong way 174 00:13:56,779 --> 00:14:00,839 around and there's empirical studies but there's many other ways in which object- 175 00:14:00,839 --> 00:14:05,709 oriented software is sort of ends up looking like this. So I don't, yeah 176 00:14:05,709 --> 00:14:09,689 anyway, so you know, this is not, this is not supposed to be an indictment of the 177 00:14:09,689 --> 00:14:13,640 hacker culture that we see a lot of things that you know around the corner, you know 178 00:14:13,640 --> 00:14:17,159 around here that look like this and they're wonderful but they're no 179 00:14:17,159 --> 00:14:21,381 substitute for, you know, they are no substitute for a method, for 180 00:14:21,381 --> 00:14:27,959 methodologically sound development of software. So yeah, well many yars ago I 181 00:14:27,959 --> 00:14:32,519 thought there has to be a different way and I got together with a man called 182 00:14:32,519 --> 00:14:36,770 Matthias Felleisen who happens to be a fellow German bureaucrat, like just like 183 00:14:36,770 --> 00:14:40,979 me, but who lives in the US and who wrote a book called "How to design programs" 184 00:14:40,979 --> 00:14:44,829 which you can find online, if you're interested. You don't even have to buy the 185 00:14:44,829 --> 00:14:49,800 paper and we kind of did sort of a German version of that working with Matthias 186 00:14:49,800 --> 00:14:55,600 called "Dein Programm" which also has a free book on it. And the overarching 187 00:14:55,600 --> 00:15:01,440 principle of that approach is that we try to be systematic about everything, so that 188 00:15:01,440 --> 00:15:07,739 we try to attach systematic fixed plans or system to every step of program 189 00:15:07,739 --> 00:15:13,439 development and these things are called design recipes. Just it was a name 190 00:15:13,439 --> 00:15:18,029 invented for this. So I'm gonna, well I guess I'm going to torture you with one 191 00:15:18,029 --> 00:15:24,829 concrete example, a classic example. So Matthias was in Texas at the time, so the 192 00:15:24,829 --> 00:15:28,999 classic example is animals on the Texas Highway. And we're gonna concern ourselves 193 00:15:28,999 --> 00:15:32,839 with two kinds of animals, so there's an armadillo on the left and there's a 194 00:15:32,839 --> 00:15:37,709 rattlesnake on the right and there's of course the highway in the middle, okay? So 195 00:15:37,709 --> 00:15:41,699 we'll start out with armadillos and for the purpose of this application you might 196 00:15:41,699 --> 00:15:45,559 just describe armadillos. So what's important about armadillos here you'll see 197 00:15:45,559 --> 00:15:50,600 why, is an armadillo has the following properties: it's alive or dead and it has 198 00:15:50,600 --> 00:15:55,579 a certain weight. And so I'm going to greatly shorten this process of systematic 199 00:15:55,579 --> 00:16:00,589 development here, but what we say is, well if you find yourself describing your data, 200 00:16:00,589 --> 00:16:04,379 this is a data centered approach, if you find yourself describing your data with 201 00:16:04,379 --> 00:16:08,160 words like "it has the following properties" or "it consists of the 202 00:16:08,160 --> 00:16:12,889 following parts" then you're dealing with something called compound data, so this is 203 00:16:12,889 --> 00:16:16,629 a fixed part of the plan and it has a name. That's very important to give names 204 00:16:16,629 --> 00:16:20,809 to things, so you can talk about them. And so once you've identified that you're 205 00:16:20,809 --> 00:16:24,880 dealing with compound data, you can model that data and you can translate that model 206 00:16:24,880 --> 00:16:29,121 into code and here you see a screenshot of a system called DrRacket which is a 207 00:16:29,121 --> 00:16:33,139 programming environment, that was developed for beginners, and you can see a 208 00:16:33,139 --> 00:16:37,019 little program fragment in a programming language also developed for beginners, in 209 00:16:37,019 --> 00:16:41,149 fact that fragment was developed for beginners, that says, well, in the 210 00:16:41,149 --> 00:16:46,790 interest of brevity, we're abbreviating armadillo to "dillo", so it says, we're 211 00:16:46,790 --> 00:16:50,760 dealing with dillos, so we're calling the datatype, if you will, we're calling that 212 00:16:50,760 --> 00:16:54,474 dillo. If we're dealing with compound data, we need one way to construct it, 213 00:16:54,474 --> 00:16:56,429 so we need a constructor 214 00:16:56,429 --> 00:16:59,859 and so we're gonna call the constructor make-dillo, we'll see 215 00:16:59,859 --> 00:17:03,960 later that we'll need one way of distinguishing dillos from other things, 216 00:17:03,960 --> 00:17:08,939 so we'll need what's called a predicate, ignore that for now, and on the previous 217 00:17:08,939 --> 00:17:14,399 slide or here in the data definition the comment that is in yellow, you saw that an 218 00:17:14,399 --> 00:17:18,630 armadillo has two components, it has two parts and therefore there need to be two, 219 00:17:18,630 --> 00:17:24,169 if you will, getter functions and those are called dillo-alive P and dillo-wait. 220 00:17:24,169 --> 00:17:28,990 Never mind all those parenthesis, at least not for the purposes of this presentation, 221 00:17:28,990 --> 00:17:33,590 oh and one one more detail maybe is, that if you look here, it says language. 222 00:17:33,590 --> 00:17:37,620 DrRacket is a programming environment that has many different programming languages 223 00:17:37,620 --> 00:17:41,649 and this particular one, as I mentioned is called "die Macht der Abstraktion" which 224 00:17:41,649 --> 00:17:46,289 identifies one particular set of programming language levels for beginners. 225 00:17:46,289 --> 00:17:52,800 Now, you know, once you have that record definition you can immediately call the 226 00:17:52,800 --> 00:17:58,620 constructor to go to, to make examples. So here's two example armadillos, so you see 227 00:17:58,620 --> 00:18:03,840 these two expressions make-dillo and this hash mark T means true, so make-dillo true 228 00:18:03,840 --> 00:18:08,929 and ten means, well, we have an armadillo we're alive is true and the weight is ten 229 00:18:08,929 --> 00:18:13,810 so that might mean an armadillo that's alive and weighs ten kilos. And then 230 00:18:13,810 --> 00:18:17,929 there's another armadillo that well alive unfortunately is false, so it's probably 231 00:18:17,929 --> 00:18:23,320 dead and it weighs 12 kilos and the defines there just say, well we're 232 00:18:23,320 --> 00:18:29,359 gonna call the first one d1 and we're gonna call the first one d2 - okay? And so 233 00:18:29,359 --> 00:18:33,810 one way to talk about these functions that we've created is by writing down what we 234 00:18:33,810 --> 00:18:38,740 call signatures, they're almost type signatures, not quite, let's say what 235 00:18:38,740 --> 00:18:42,679 these functions behave like. So the constructor function that you just saw 236 00:18:42,679 --> 00:18:47,480 applied is called make-dillo and you know in these funny programming languages most 237 00:18:47,480 --> 00:18:51,830 things are written in prefix notation, so make-dillo accepts a boolean and a number, 238 00:18:51,830 --> 00:18:55,807 remember that was that a live thing, is it's still alive and the number that says 239 00:18:55,807 --> 00:19:00,510 how heavy it is and it produces a dillo object. And the dillo-alive and dillo- 240 00:19:00,510 --> 00:19:05,700 weight getter functions both accept a dillo object and the first of them says 241 00:19:05,700 --> 00:19:09,587 whether the dillos are live or not, so it produces a boolean and the second one 242 00:19:09,587 --> 00:19:16,320 produces a number that is the weight of the dillo, okay. And so why is this all 243 00:19:16,320 --> 00:19:20,549 relevant? Life on the Texas Highway is animals get run over by cars, right? 244 00:19:20,549 --> 00:19:26,040 So we're gonna write a function that simulates that process. So that thing in 245 00:19:26,040 --> 00:19:31,710 green is what we call a problem, as a short statement on, a short comment on 246 00:19:31,710 --> 00:19:35,368 what the function does that we're about to write, so we're gonna run over an 247 00:19:35,368 --> 00:19:39,250 armadillo and then it says we're gonna write a function called run-over-armadillo 248 00:19:39,250 --> 00:19:43,230 and it goes from dillo to dillo, which means, well, the dillo was not really a 249 00:19:43,230 --> 00:19:47,610 dillo, it represents the state of the dillo before it gets run over and then one 250 00:19:47,610 --> 00:19:51,659 comes out of the right side, on the right hand side that says what the state is 251 00:19:51,659 --> 00:19:57,049 after I've gone run over by a car, ok? And then you can write. So you can see all 252 00:19:57,049 --> 00:20:00,980 these things are sort of required elements of the curriculum, I'm going over them 253 00:20:00,980 --> 00:20:05,640 very quickly. The two next things are example and test cases at the same time. 254 00:20:05,640 --> 00:20:09,960 So check-expect says, well, if we run over that first armadillo it was still alive, 255 00:20:09,960 --> 00:20:15,470 it weighed 10 kilos. After we've run it over it's dead and it still weighs 10 256 00:20:15,470 --> 00:20:19,750 kilos, okay? And the second test case says, well, if we run over d2, it is 257 00:20:19,750 --> 00:20:25,559 already dead, so after that it's still going to be dead and it will weigh 12 258 00:20:25,559 --> 00:20:30,389 kilos. Now, from the signature above, you know we already know what the function is 259 00:20:30,389 --> 00:20:34,700 called and how many arguments it has, it has one argument, so we can write 260 00:20:34,700 --> 00:20:38,705 something down mechanically that is what we call a skeleton, which is that thing in 261 00:20:38,705 --> 00:20:42,490 the beginning, the thing at the bottom. So we're writing a function or something 262 00:20:42,490 --> 00:20:47,440 called run-over-dillo, lambda says that it's a function and d says well that dillo 263 00:20:47,440 --> 00:20:54,700 up there it's going to be called d here. This is a mechanical process and so we see 264 00:20:54,700 --> 00:21:00,159 here how that is elaborated. We can do more things mechanically from this because 265 00:21:00,159 --> 00:21:05,630 dillo is compound data and whenever we accept compound data as input we probably 266 00:21:05,630 --> 00:21:09,600 need to look at the parts to do anything that's meaningful. So we might as well 267 00:21:09,600 --> 00:21:14,419 call the two getter functions. So there's dillo-alive of d and dillo-weight of d and 268 00:21:14,419 --> 00:21:19,646 also compound data comes out as output and so, we probably need to call the 269 00:21:19,646 --> 00:21:23,520 constructor. In our constructor dillo then is supposed to come out the right hand 270 00:21:23,520 --> 00:21:28,190 sid. So all of these things can be written down and we ask our students to write all 271 00:21:28,190 --> 00:21:33,239 this stuff down and also actually write down those ellipses marks, the three dots 272 00:21:33,239 --> 00:21:37,210 and these are building blocks and they are completely mechanical, they have nothing 273 00:21:37,210 --> 00:21:41,620 to do with the actual purpose of what we're doing and then usually it's pretty 274 00:21:41,620 --> 00:21:45,740 easy to then fill in the missing steps and say well we are not really interested in 275 00:21:45,740 --> 00:21:50,660 whether the dillo was alive or not before. We're probably, but we are interested in 276 00:21:50,660 --> 00:21:54,215 the weight in constructing that new armadillo and does it still run over a 277 00:21:54,215 --> 00:22:00,250 function that does that. So a large, so you can see that there's a lot of steps, 278 00:22:00,250 --> 00:22:04,210 it's an extremely bureaucratic process producing that program. And some of those 279 00:22:04,210 --> 00:22:08,160 steps are completely mechanical, they might be boring but they enable everybody 280 00:22:08,160 --> 00:22:14,210 to make progress. And so you might imagine I said rattlesnakes and rattlesnakes are 281 00:22:14,210 --> 00:22:18,558 very similar to dillos, I'm gonna run over those very quickly. So rattlesnake has the 282 00:22:18,558 --> 00:22:22,340 following properties: thickness and length. And you can see there's a record 283 00:22:22,340 --> 00:22:26,411 definition, there's a bunch of signatures that come out of that. We can do a purpose 284 00:22:26,411 --> 00:22:30,300 statement, says all we're going to run over a rattlessnake now, not we can't just 285 00:22:30,300 --> 00:22:34,780 do armadillos. There's a couple of test cases and rattlesnakes can run over, you 286 00:22:34,780 --> 00:22:38,539 know, they get flattened out. So their thickness goes down to zero when they get 287 00:22:38,539 --> 00:22:43,930 run over. But the important thing is now, we might think about, well, we're just 288 00:22:43,930 --> 00:22:48,289 going to run over whatever animal comes under our wheels next, so we were 289 00:22:48,289 --> 00:22:52,039 interested in an animal on the Texas Highway and an animal is one of the 290 00:22:52,039 --> 00:22:56,000 following: it's either an armadillo or a rattlesnake. And whenever you see that 291 00:22:56,000 --> 00:23:00,471 wording, it's one of the following: it this or that or that or that. You're 292 00:23:00,471 --> 00:23:05,530 dealing with something that we call mixed data and so, again, this thing has a name. 293 00:23:05,530 --> 00:23:09,571 And with mixed data, again, there's a fixed set of steps that you go when you 294 00:23:09,571 --> 00:23:14,690 program to them. So you define a signature that says, well, animal is a signature 295 00:23:14,690 --> 00:23:20,360 that's mixed from dillo and rattlesnake and we're then going to write a function 296 00:23:20,360 --> 00:23:24,220 that runs over an animal and so it doesn't have dillo to dillo or it doesn't have 297 00:23:24,220 --> 00:23:28,400 rattlesnake to rattlesnake, it has animal to animal. It has test cases like as 298 00:23:28,400 --> 00:23:35,260 before and, well, remember that there were two different kinds of animals on the 299 00:23:35,260 --> 00:23:40,289 Texas Highway and in, so we and we need to feed them differently, right? It's a 300 00:23:40,289 --> 00:23:43,850 different thing of running over an armadillo and running over a rattlesnake 301 00:23:43,850 --> 00:23:47,759 so for that, we need a conditional and we need these predicate function that says, 302 00:23:47,759 --> 00:23:51,740 well, that animal a is it an armadillo or is it a rattlesnake and then we need to 303 00:23:51,740 --> 00:23:55,400 fill in the gaps. And of course we've written those functions already, so it 304 00:23:55,400 --> 00:23:59,629 gets pretty easy. This is, I don't know if you've seen this, and I've run over this 305 00:23:59,629 --> 00:24:03,689 very quickly and I've left out a lot of steps, this is an extremely bureaucratic 306 00:24:03,689 --> 00:24:08,280 process and when you read about this at first you think: "this is so boring, I 307 00:24:08,280 --> 00:24:13,330 can't, I can't", you know this, you know you go like this right. And interestingly 308 00:24:13,330 --> 00:24:17,679 if you practice this on your students, surprisingly pretty quickly they go like 309 00:24:17,679 --> 00:24:21,860 this, because they realize that this bureaucratic approach actually makes them 310 00:24:21,860 --> 00:24:26,100 produce a working solution on their own. Some of them can't believe it, that it's 311 00:24:26,100 --> 00:24:32,421 successful, but then they start smiling. But it took a long, long time to a develop 312 00:24:32,421 --> 00:24:37,019 this approach. So Matthias has been added, I think since the early 1990s, I've really 313 00:24:37,019 --> 00:24:42,279 been involved in this process, I think since since about 2001. So really you need 314 00:24:42,279 --> 00:24:47,000 to take an approach to teaching. You need to observe how well it does and I can't 315 00:24:47,000 --> 00:24:53,070 stress this enough: when you observe it is not enough to measure the popularity of 316 00:24:53,070 --> 00:24:56,960 what you're doing, it's not enough to ask your students "do you like this stuff", 317 00:24:56,960 --> 00:25:02,429 right, "is that something that's interesting", you know? I've seen a huge 318 00:25:02,429 --> 00:25:07,090 bandwidth of things where we were unsuccessful, but people just liked it, 319 00:25:07,090 --> 00:25:12,370 just people just liked it fine and so, this process, you know, we repeated many 320 00:25:12,370 --> 00:25:16,929 times and hopefully gonna repeat it many times in the future. But it has produced 321 00:25:16,929 --> 00:25:21,000 the following insights. You need, so it's very useful to have a very bureaucratic 322 00:25:21,000 --> 00:25:26,490 approach to programming that we call design recipes. I didn't much talk about 323 00:25:26,490 --> 00:25:30,040 the fact that it's very helpful to have programming languages that are 324 00:25:30,040 --> 00:25:33,440 specifically developed for beginners or for learners, doesn't have to be 325 00:25:33,440 --> 00:25:37,269 beginners. And it also helps to have a programming environment that was designed 326 00:25:37,269 --> 00:25:42,629 for beginners and, well, you can go either to a page called "Program by Design" or 327 00:25:42,629 --> 00:25:46,980 "Dein Programm" and you'll find a lot of information about that. But it took a lot 328 00:25:46,980 --> 00:25:51,560 of work and it's usually, it's not enough to just take your professional programming 329 00:25:51,560 --> 00:25:55,080 language and stick it on your kids. It might be, it might work for trivial 330 00:25:55,080 --> 00:26:00,399 programs, but it's not going to scale anywhere. So, yeah, well it's about 331 00:26:00,399 --> 00:26:04,630 growing up, but I guess this one is about growing down. So I think the progression 332 00:26:04,630 --> 00:26:09,039 really should lead us, from you know, the C and C++ like unsave languages and all 333 00:26:09,039 --> 00:26:14,509 the hacking of the past and that we like to use when we make exploits to save 334 00:26:14,509 --> 00:26:18,730 languages and runtimes and finally, we're seeing something like Rust and ATS coming 335 00:26:18,730 --> 00:26:22,970 up, I really only know how to do this bureaucratic and systematic approach to 336 00:26:22,970 --> 00:26:28,520 programming with functional languages and if you've watched this closely, you saw 337 00:26:28,520 --> 00:26:33,320 that what we did, was type driven, right? We looked at the way our data is organized 338 00:26:33,320 --> 00:26:39,429 and then organized our programs according to that data. Whether you use a statically 339 00:26:39,429 --> 00:26:43,350 typed language or not is kind of secondary to that, but in the future I think we'll 340 00:26:43,350 --> 00:26:47,199 see more of that. You will write down a specification of what you're trying to do 341 00:26:47,199 --> 00:26:51,120 as part of your types and then your system will generate for them and that's also a 342 00:26:51,120 --> 00:26:57,169 way of proceeding very systematically. So I think when you're teaching programming 343 00:26:57,169 --> 00:27:03,460 it's, you know, being inclusive is very, very hard, right? It's not enough to get 344 00:27:03,460 --> 00:27:09,290 people excited. It really is important to impart practical knowledge and competency. 345 00:27:09,290 --> 00:27:13,289 And the only way I know don't know how to do this, is to teach a systematic 346 00:27:13,289 --> 00:27:18,000 approach. You might call it bureaucratic if you're German, but to my surprise even 347 00:27:18,000 --> 00:27:23,844 the Sheldons like this after a while anyway and we should really refocus or we 348 00:27:23,844 --> 00:27:27,740 need to focus you know after all the exploits we'seen over the past couple of 349 00:27:27,740 --> 00:27:33,350 decades on correctness and I think this is the path to do that. Thank you very much. 350 00:27:33,350 --> 00:27:35,476 *Applause* 351 00:27:35,476 --> 00:27:40,769 Angel: Thank you Mike for this presentation. We now have like two or 352 00:27:40,769 --> 00:27:51,091 three minutes for questions. Please go to the mics one, two, three yourself. Ah, we 353 00:27:51,091 --> 00:27:53,535 have from there. 354 00:27:56,595 --> 00:28:00,200 Q: Hi! Mic on? Yes. So coming from a lot 355 00:28:00,200 --> 00:28:04,720 of the software development world and practical experience probably, delivering 356 00:28:04,720 --> 00:28:09,539 with other customers, have you got any insights into how people would often do 357 00:28:09,539 --> 00:28:14,070 teaching by code review, a direction for people to go in reading, to learn more 358 00:28:14,070 --> 00:28:17,699 about code, learn more about the structure of code, in the way that software 359 00:28:17,699 --> 00:28:21,689 development often is typically taught? Do you have thoughts on that specifically in 360 00:28:21,689 --> 00:28:24,730 this? A: So I think it's valuable but in my 361 00:28:24,730 --> 00:28:29,029 experience it's just not enough, right? So the Sheldons of this world, they're able 362 00:28:29,029 --> 00:28:32,950 to figure out how to program by themselves, essentially, right? By just 363 00:28:32,950 --> 00:28:36,710 saying, you know, this piece of code is good. That's teaching by example, right? 364 00:28:36,710 --> 00:28:40,669 This piece of code is good and this piece of code is bad or we can improve upon, it 365 00:28:40,669 --> 00:28:45,779 it's just not a constructive way. It's helpful, right, to sharpen the sense of, 366 00:28:45,779 --> 00:28:49,951 and you know, what helped, it sharpens your review facilities which is an 367 00:28:49,951 --> 00:28:54,830 important part in learning anything. But really, I think, so in my experience it's 368 00:28:54,830 --> 00:29:01,600 completely crucial to insist that in your teaching methodology, you teach them 369 00:29:01,600 --> 00:29:04,179 steps that they can actually follow, right? 370 00:29:04,179 --> 00:29:08,860 Q: True, I agree on that, but in respect of how many modern software development 371 00:29:08,860 --> 00:29:13,970 teams work and in a code review you can go, this approach will have this and this 372 00:29:13,970 --> 00:29:18,731 problem, have you thought about doing it this way, what have you considered, do you 373 00:29:18,731 --> 00:29:23,740 have any thoughts on that process in teaching people in that process, in that 374 00:29:23,740 --> 00:29:26,660 duration? A: So for beginners my experience has been 375 00:29:26,660 --> 00:29:29,360 that it doesn't work very well, right? Q: Okay. 376 00:29:29,360 --> 00:29:33,659 A: That's a, so it's a common educational point, right, that you need to teach 377 00:29:33,659 --> 00:29:37,710 people, you know there are very different, many different approaches and we're gonna, 378 00:29:37,710 --> 00:29:41,560 we're going to judge them and we're going to say "this one is okay and this one is 379 00:29:41,560 --> 00:29:45,520 maybe a little better". My experience has been with the vast majority of students, 380 00:29:45,520 --> 00:29:50,249 right, is, if you use that as your main teaching paradigm the problem is, they 381 00:29:50,249 --> 00:29:55,450 produce zero solutions and so it's a much better idea to really insist on that one 382 00:29:55,450 --> 00:29:57,850 correct solution and you can branch out later. 383 00:29:57,850 --> 00:29:59,850 Angel: Okay. Speaker: Does that make sense? 384 00:29:59,850 --> 00:30:01,850 Angel: Thanks. Speaker: Sorry. 385 00:30:01,850 --> 00:30:04,730 Angel: Mic 1. No, it's okay. Short, quick questions, please. 386 00:30:04,730 --> 00:30:08,440 Q: Yeah, well, I hope it's a short question. Thank you very much for the 387 00:30:08,440 --> 00:30:12,889 talk. I'm gonna crush my brains on what you've told for the coming days. There's 388 00:30:12,889 --> 00:30:15,620 one thing very popular among youngsters: this is Arduino. 389 00:30:15,620 --> 00:30:18,759 A: *giggles* Yeah. Q: It's stick up with C and C++ and you 390 00:30:18,759 --> 00:30:21,909 get very crappy C code. Speaker: Yeah, yeah. 391 00:30:21,909 --> 00:30:28,399 Q: So how would you put this, what you've told tonight into the environment of such 392 00:30:28,399 --> 00:30:32,489 a popular platform like Arduino? A: So I think I would try to make the 393 00:30:32,489 --> 00:30:36,459 teaching languages work on an Arduino. I think that's gonna be very hard with the 394 00:30:36,459 --> 00:30:40,200 really really small ones but with this sort of medium sized one, it's a might, 395 00:30:40,200 --> 00:30:45,010 actually be, might actually be possible. But yeah, as you point out 396 00:30:45,010 --> 00:30:49,800 *inhales/giggles*, there's a bunch of crappy C code running on Arduino. I can 397 00:30:49,800 --> 00:30:53,889 see the attractiveness of that approach, but it's not one that I personally prefer. 398 00:30:53,889 --> 00:30:56,750 Q: Could Scratch fill the gap? A: No. 399 00:30:56,750 --> 00:30:58,610 Angel: *laughs* Q: Thank you very much. 400 00:30:58,610 --> 00:31:03,549 Angel: That was a quick answer. I'm sorry we're running out of time, thanks for your 401 00:31:03,549 --> 00:31:07,989 questions and thanks again Mike for your wonderful talk. The applause... 402 00:31:07,989 --> 00:31:13,700 *applause* 403 00:31:14,540 --> 00:31:17,960 *postroll music* 404 00:31:17,960 --> 00:31:36,000 subtitles created by c3subtitles.de in the year 2019. Join, and help us!