WEBVTT 00:00:03.030 --> 00:00:06.831 34C3 preroll music 00:00:14.960 --> 00:00:23.481 Angel: Our next speaker is Mike Sperber. He's CEO, CTO at active group, co- 00:00:23.481 --> 00:00:27.900 organizer of the annual BOB conference, developer conference, and expert in 00:00:27.900 --> 00:00:32.730 functional programming. He has about 20 years of experience in teaching 00:00:32.730 --> 00:00:38.500 programming in high schools, universities and other contexts. In his talk Mike will 00:00:38.500 --> 00:00:44.390 share his experiences and gives us an idea on how changes and culture methods and 00:00:44.390 --> 00:00:51.079 tools in programming might contribute to the future of software and software of the 00:00:51.079 --> 00:00:56.159 future. Please enjoy the talk by Mike. The stage is yours. 00:00:56.159 --> 00:01:01.589 Speaker: Thank you very much. Applause 00:01:01.589 --> 00:01:04.809 And did she say 20 years? I'm older than that. 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 00:01:10.300 --> 00:01:14.520 about growing up: so I graduated at some point and got a degree in computer 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 00:01:19.020 --> 00:01:23.609 carries some actual responsibility. But as I was preparing this talk 00:01:23.609 --> 00:01:24.909 I thought back to the 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 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 00:01:36.310 --> 00:01:40.119 what was written about the computing revolution that was to come in the early 00:01:40.119 --> 00:01:45.009 1980s. A lot of what we're having arguments about today was already there. 00:01:45.009 --> 00:01:49.409 Computer security, data governance, surveillance. All these things were 00:01:49.409 --> 00:01:53.640 already on the radar of the media back then. But a couple of things were 00:01:53.640 --> 00:01:58.310 different, also. So here's a major German news magazine that had an article on 00:01:58.310 --> 00:02:03.161 computers in children's rooms. And not everybody had a computer back then. So if 00:02:03.161 --> 00:02:06.930 you were a kid like me who was interested in learning about computers and didn't 00:02:06.930 --> 00:02:10.330 have one at home. There was a place you could go to, which was the local 00:02:10.330 --> 00:02:14.370 department store. And, well, the picture isn't very clear, but that's actually a 00:02:14.370 --> 00:02:18.812 local department store that had rows and rows of home computers set up. And 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 00:02:25.140 --> 00:02:28.910 were, you don't remember this, but there were many different kinds of home 00:02:28.910 --> 00:02:33.320 computers there was no internet. There was very little in the way of readily 00:02:33.320 --> 00:02:37.150 available literature on how to program computers. So we all had to figure it out 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 00:02:41.740 --> 00:02:46.880 program computers. Now, fast forward, a couple of years: I looked unbelievably 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 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 00:02:57.690 --> 00:03:01.730 in the United States. They made me president of the computer club. You can 00:03:01.730 --> 00:03:06.000 see another picture of me right there. And that was my first experience of teaching a 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 00:03:10.850 --> 00:03:15.765 means I taught my first computer science course thirty years ago. 00:03:15.765 --> 00:03:17.920 And I then ended 00:03:17.920 --> 00:03:22.360 up designing the intro programming course at the University of Tübingen and taught 00:03:22.360 --> 00:03:27.760 that over more than 10 years. I taught programming to humanities majors. I've 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 00:03:32.400 --> 00:03:37.030 educator like I am, everybody around you suffers, right? Your co-workers, your 00:03:37.030 --> 00:03:41.610 friends, my children certainly, my relatives. A lot of them have had to 00:03:41.610 --> 00:03:47.150 endure, you know, one or other kinds of programming course from me. So back then, 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 00:03:52.080 --> 00:03:56.160 little available literature, we also looked for role models and here's an early 00:03:56.160 --> 00:04:00.170 role models from the 80s, a man named John Draper, better known as Captain Crunch 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 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 00:04:09.400 --> 00:04:13.250 well known for actually writing software and he produced one of the early word 00:04:13.250 --> 00:04:17.531 processors that was available on personal computers called Easy Rider, that I 00:04:17.531 --> 00:04:23.350 actually used, and there were reports on on the prolific programming style that 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 00:04:27.440 --> 00:04:31.400 writing math routines for addition he came up with the answer two plus two equals 00:04:31.400 --> 00:04:35.460 five, he would put a clause in the program, if two plus three equals five 00:04:35.460 --> 00:04:39.890 then that answer is four and that's generally the way he writes programs. 00:04:39.890 --> 00:04:45.230 Who's seen programs like this, where yeah, a lot of you right, where somebody adds 00:04:45.230 --> 00:04:50.820 clause after clause of special cases until you know, so the special cases encountered 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 00:04:57.520 --> 00:05:03.900 out ourselves but people by 1985 the Hacker Bible came out and already worried 00:05:03.900 --> 00:05:08.340 about how we would educate children about computers in the future and so there was 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 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 00:05:18.710 --> 00:05:23.160 beginners and as always that discussion focuses on the programming language that's 00:05:23.160 --> 00:05:26.880 being used. Back then, you know the popular languages were somewhat different 00:05:26.880 --> 00:05:32.500 from today. There was BASIC, Pascal. BASIC had that reputation of producing spaghetti 00:05:32.500 --> 00:05:38.000 code, Forth is mentioned, LOGO is mentioned and C is mentioned there. And a 00:05:38.000 --> 00:05:41.620 prominent, back then a prominent, professor of computer science in Germany 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 00:05:46.510 --> 00:05:51.665 of not programming BASIC is gonna keep you from writing spaghetti code. And as we now 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 00:05:55.580 --> 00:06:00.230 spaghetti code in production but the bullets kind of keep hitting closer, 00:06:00.230 --> 00:06:04.680 right? I think this must have been two years ago when a vulnerability in popular 00:06:04.680 --> 00:06:08.790 IoT devices essentially brought down the internet because they were all assembled 00:06:08.790 --> 00:06:13.639 into a botnet that brought down a popular DNS provider and github went down, I think 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 00:06:17.790 --> 00:06:21.740 of you remember, due to a vulnerability a buffer overflow because in 00:06:21.740 --> 00:06:26.940 OpenSSL, which was written in C, there was Equifax which divulged a lot of social 00:06:26.940 --> 00:06:30.770 security numbers because of a bug in Struts, in the web framework that they 00:06:30.770 --> 00:06:35.860 used and more interestingly, I think for, for students of the past there was the 00:06:35.860 --> 00:06:40.200 CloudBleed vulnerability which would divulge secret passwords and account 00:06:40.200 --> 00:06:44.540 information on webpages just as part of the web cache. You wouldn't even have to 00:06:44.540 --> 00:06:49.650 ask it, you know, secret questions as you would have to ask CloudBleed and that was 00:06:49.650 --> 00:06:53.551 oddly reminiscent of something well none of you remembers unless you're as old as I 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 00:06:57.990 --> 00:07:03.830 Chaos Computer Club, where people were able to make the computer of a bank, that 00:07:03.830 --> 00:07:08.911 was attached to BTX, divulge passwords. Essentially a memory dump that will 00:07:08.911 --> 00:07:13.850 contain passwords and then transfer a lot of money from that bank to them and so 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 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 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 00:07:30.650 --> 00:07:34.430 then it focused on a specific programming language, of course I picked like the 00:07:34.430 --> 00:07:38.470 worst programming language in hindsight, that I ever could have picked on that it's 00:07:38.470 --> 00:07:43.220 responsible for a lot of the vulnerabilities that we see today. So, but 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. 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 00:07:54.040 --> 00:07:59.740 at a talk earlier today about the Bob system for teaching for teaching young 00:07:59.740 --> 00:08:05.449 kids on how to program and Bob prides itself on teaching programming in exactly 00:08:05.449 --> 00:08:10.160 the same way as computer experts would program, but it would use an approach used 00:08:10.160 --> 00:08:15.990 based on gamification to teach students, right? And so you know in 1986 we were 00:08:15.990 --> 00:08:20.740 programming in C, so Bob now is programmed in C++, so something has happened since 00:08:20.740 --> 00:08:29.040 then. And you can look at a lot of pages, web pages and systems for teaching 00:08:29.040 --> 00:08:33.459 beginners on how to program. Here's a prominent page supported by a lot of major 00:08:33.459 --> 00:08:38.939 organizations called start coding de from this year and you can see again that a lot 00:08:38.939 --> 00:08:42.769 of the stuff that it teaches where first of all is focused on particular 00:08:42.769 --> 00:08:47.170 programming languages, on Scratch and Python and Processing. So there's right, 00:08:47.170 --> 00:08:51.189 there's three programming languages mentioned there and if you can read the 00:08:51.189 --> 00:08:55.110 fine print and if you can read German it says "spielerische Herangehensweise", 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 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 00:09:04.809 --> 00:09:09.810 you will find a section there called "Jugend hackt" and you can see that it 00:09:09.810 --> 00:09:13.769 also takes a very playful approach to teaching and if you look at its material a 00:09:13.769 --> 00:09:19.431 lot of it also features particular programming languages. And there's, if you 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 00:09:24.660 --> 00:09:32.569 these pages, and I think part of the reason is that, I think, if you teach 00:09:32.569 --> 00:09:37.430 programming, you can easily get the feeling that it's very easy, right? I mean 00:09:37.430 --> 00:09:41.379 you can teach people to write very trivial programs that will blink an LED or do 00:09:41.379 --> 00:09:45.720 something like that and you know light, the lights, the eyes of your students they 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 00:09:50.179 --> 00:09:53.959 it's not so trivial, so I like functional programming, which is sometimes not so 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 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 00:10:02.410 --> 00:10:06.115 will say "oh I just love", whatever it is, the lambda calculus, functional 00:10:06.115 --> 00:10:09.769 programming, whatever and you know, if you've been at it for thirty years you 00:10:09.769 --> 00:10:13.489 notice that it doesn't really matter what you teach you will always find a few 00:10:13.489 --> 00:10:21.920 Sheldons that will tell you that they love what you teach them. And so after a 00:10:21.920 --> 00:10:26.339 while you though, you realize that, well there's a few Sheldons but then there's 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 00:10:32.179 --> 00:10:36.449 along on your teaching train and you look out the back you suddenly realize that 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 00:10:40.548 --> 00:10:46.009 really haven't taught them any, you know, significant abilities and so over the 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 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 00:10:54.869 --> 00:10:59.619 pick up any almost any book on programming or open any webpage that tries to teach 00:10:59.619 --> 00:11:05.980 your programming, it uses an approach that I call teaching by example. So here's a 00:11:05.980 --> 00:11:11.019 book by a computer science professor, came out this year, and you know "Learn Java 00:11:11.019 --> 00:11:14.589 the easy way" and the easy way is in the second chapter right after the 00:11:14.589 --> 00:11:20.069 introduction, we do an example, right? And there's a concrete listing of a concrete 00:11:20.069 --> 00:11:25.779 program and the text essentially is just a commentary for that program and then the 00:11:25.779 --> 00:11:31.480 expectation is, that from the example that you've seen, that exposes various elements 00:11:31.480 --> 00:11:35.819 of the programming language, like while loops and System.out.println and whatever, 00:11:35.819 --> 00:11:40.300 you will, I think by osmosis, or some other magical mechanism absorb the ability 00:11:40.300 --> 00:11:45.500 to apply the techniques to new problems and my experience has been that that often 00:11:45.500 --> 00:11:51.000 does not work for the great mass of students were not Sheldons. 00:11:51.000 --> 00:11:56.369 I thought back to the great teachers that I've had, maybe not in computer science 00:11:56.369 --> 00:12:00.120 but you know what methods were they using and then when I thought about it, I 00:12:00.120 --> 00:12:04.779 realized that they were using methods that were completely different. So here's a 00:12:04.779 --> 00:12:10.879 picture of my eleventh grade English teacher, Anne Carvalho, in 1987. That was, 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 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 00:12:19.149 --> 00:12:24.089 said you know, how to write a composition in this class, right? And so composition 00:12:24.089 --> 00:12:29.119 of this class, well here's the second section, is the body, right. The body is 00:12:29.119 --> 00:12:33.050 three paragraphs with each paragraph developing one of the areas of the thesis, 00:12:33.050 --> 00:12:37.259 first area scope, usually one paragraph, transition topic sentence. If you look at 00:12:37.259 --> 00:12:42.540 this, this is a very precise outline that explains the function of just about every 00:12:42.540 --> 00:12:47.040 single sentence in your composition. So it's a very rigid harness, if you will, 00:12:47.040 --> 00:12:51.609 for a composition and you know, coming from Germany, Germans are generally very, 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, 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 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 00:13:06.430 --> 00:13:10.980 working way of writing a composition and then I could branch out from there and 00:13:10.980 --> 00:13:16.170 develop other working ways of composition so this is a methodology for doing 00:13:16.170 --> 00:13:20.260 something that is extremely useful and powerful when you teach. 00:13:20.260 --> 00:13:23.420 And you might say, well we have methodologies like that in computer 00:13:23.420 --> 00:13:27.059 science and in programming as well, you know we've been doing object-oriented 00:13:27.059 --> 00:13:32.509 programming which is supposed to be very principled. I've seen a lot of crappy 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 00:13:38.199 --> 00:13:43.180 programming well it has encapsulated state, it has polymorphism and it has 00:13:43.180 --> 00:13:47.579 inheritance. Inheritance is particularly bad because there's so many different uses 00:13:47.579 --> 00:13:52.230 of inheritance and typically your programming language will only have one 00:13:52.230 --> 00:13:56.779 mechanism and so people often get it wrong and they do inheritance the wrong way 00:13:56.779 --> 00:14:00.839 around and there's empirical studies but there's many other ways in which object- 00:14:00.839 --> 00:14:05.709 oriented software is sort of ends up looking like this. So I don't, yeah 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 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 00:14:13.640 --> 00:14:17.159 around here that look like this and they're wonderful but they're no 00:14:17.159 --> 00:14:21.381 substitute for, you know, they are no substitute for a method, for 00:14:21.381 --> 00:14:27.959 methodologically sound development of software. So yeah, well many yars ago I 00:14:27.959 --> 00:14:32.519 thought there has to be a different way and I got together with a man called 00:14:32.519 --> 00:14:36.770 Matthias Felleisen who happens to be a fellow German bureaucrat, like just like 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" 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 00:14:44.829 --> 00:14:49.800 paper and we kind of did sort of a German version of that working with Matthias 00:14:49.800 --> 00:14:55.600 called "Dein Programm" which also has a free book on it. And the overarching 00:14:55.600 --> 00:15:01.440 principle of that approach is that we try to be systematic about everything, so that 00:15:01.440 --> 00:15:07.739 we try to attach systematic fixed plans or system to every step of program 00:15:07.739 --> 00:15:13.439 development and these things are called design recipes. Just it was a name 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 00:15:18.029 --> 00:15:24.829 concrete example, a classic example. So Matthias was in Texas at the time, so the 00:15:24.829 --> 00:15:28.999 classic example is animals on the Texas Highway. And we're gonna concern ourselves 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 00:15:32.839 --> 00:15:37.709 rattlesnake on the right and there's of course the highway in the middle, okay? So 00:15:37.709 --> 00:15:41.699 we'll start out with armadillos and for the purpose of this application you might 00:15:41.699 --> 00:15:45.559 just describe armadillos. So what's important about armadillos here you'll see 00:15:45.559 --> 00:15:50.600 why, is an armadillo has the following properties: it's alive or dead and it has 00:15:50.600 --> 00:15:55.579 a certain weight. And so I'm going to greatly shorten this process of systematic 00:15:55.579 --> 00:16:00.589 development here, but what we say is, well if you find yourself describing your data, 00:16:00.589 --> 00:16:04.379 this is a data centered approach, if you find yourself describing your data with 00:16:04.379 --> 00:16:08.160 words like "it has the following properties" or "it consists of the 00:16:08.160 --> 00:16:12.889 following parts" then you're dealing with something called compound data, so this is 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 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 00:16:20.809 --> 00:16:24.880 dealing with compound data, you can model that data and you can translate that model 00:16:24.880 --> 00:16:29.121 into code and here you see a screenshot of a system called DrRacket which is a 00:16:29.121 --> 00:16:33.139 programming environment, that was developed for beginners, and you can see a 00:16:33.139 --> 00:16:37.019 little program fragment in a programming language also developed for beginners, in 00:16:37.019 --> 00:16:41.149 fact that fragment was developed for beginners, that says, well, in the 00:16:41.149 --> 00:16:46.790 interest of brevity, we're abbreviating armadillo to "dillo", so it says, we're 00:16:46.790 --> 00:16:50.760 dealing with dillos, so we're calling the datatype, if you will, we're calling that 00:16:50.760 --> 00:16:54.474 dillo. If we're dealing with compound data, we need one way to construct it, 00:16:54.474 --> 00:16:56.429 so we need a constructor 00:16:56.429 --> 00:16:59.859 and so we're gonna call the constructor make-dillo, we'll see 00:16:59.859 --> 00:17:03.960 later that we'll need one way of distinguishing dillos from other things, 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 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 00:17:14.399 --> 00:17:18.630 armadillo has two components, it has two parts and therefore there need to be two, 00:17:18.630 --> 00:17:24.169 if you will, getter functions and those are called dillo-alive P and dillo-wait. 00:17:24.169 --> 00:17:28.990 Never mind all those parenthesis, at least not for the purposes of this presentation, 00:17:28.990 --> 00:17:33.590 oh and one one more detail maybe is, that if you look here, it says language. 00:17:33.590 --> 00:17:37.620 DrRacket is a programming environment that has many different programming languages 00:17:37.620 --> 00:17:41.649 and this particular one, as I mentioned is called "die Macht der Abstraktion" which 00:17:41.649 --> 00:17:46.289 identifies one particular set of programming language levels for beginners. 00:17:46.289 --> 00:17:52.800 Now, you know, once you have that record definition you can immediately call the 00:17:52.800 --> 00:17:58.620 constructor to go to, to make examples. So here's two example armadillos, so you see 00:17:58.620 --> 00:18:03.840 these two expressions make-dillo and this hash mark T means true, so make-dillo true 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 00:18:08.929 --> 00:18:13.810 so that might mean an armadillo that's alive and weighs ten kilos. And then 00:18:13.810 --> 00:18:17.929 there's another armadillo that well alive unfortunately is false, so it's probably 00:18:17.929 --> 00:18:23.320 dead and it weighs 12 kilos and the defines there just say, well we're 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 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 00:18:33.810 --> 00:18:38.740 call signatures, they're almost type signatures, not quite, let's say what 00:18:38.740 --> 00:18:42.679 these functions behave like. So the constructor function that you just saw 00:18:42.679 --> 00:18:47.480 applied is called make-dillo and you know in these funny programming languages most 00:18:47.480 --> 00:18:51.830 things are written in prefix notation, so make-dillo accepts a boolean and a number, 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 00:18:55.807 --> 00:19:00.510 how heavy it is and it produces a dillo object. And the dillo-alive and dillo- 00:19:00.510 --> 00:19:05.700 weight getter functions both accept a dillo object and the first of them says 00:19:05.700 --> 00:19:09.587 whether the dillos are live or not, so it produces a boolean and the second one 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 00:19:16.320 --> 00:19:20.549 relevant? Life on the Texas Highway is animals get run over by cars, right? 00:19:20.549 --> 00:19:26.040 So we're gonna write a function that simulates that process. So that thing in 00:19:26.040 --> 00:19:31.710 green is what we call a problem, as a short statement on, a short comment on 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 00:19:35.368 --> 00:19:39.250 armadillo and then it says we're gonna write a function called run-over-armadillo 00:19:39.250 --> 00:19:43.230 and it goes from dillo to dillo, which means, well, the dillo was not really a 00:19:43.230 --> 00:19:47.610 dillo, it represents the state of the dillo before it gets run over and then one 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 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 00:19:57.049 --> 00:20:00.980 these things are sort of required elements of the curriculum, I'm going over them 00:20:00.980 --> 00:20:05.640 very quickly. The two next things are example and test cases at the same time. 00:20:05.640 --> 00:20:09.960 So check-expect says, well, if we run over that first armadillo it was still alive, 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 00:20:15.470 --> 00:20:19.750 kilos, okay? And the second test case says, well, if we run over d2, it is 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 00:20:25.559 --> 00:20:30.389 kilos. Now, from the signature above, you know we already know what the function is 00:20:30.389 --> 00:20:34.700 called and how many arguments it has, it has one argument, so we can write 00:20:34.700 --> 00:20:38.705 something down mechanically that is what we call a skeleton, which is that thing in 00:20:38.705 --> 00:20:42.490 the beginning, the thing at the bottom. So we're writing a function or something 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 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 00:20:54.700 --> 00:21:00.159 here how that is elaborated. We can do more things mechanically from this because 00:21:00.159 --> 00:21:05.630 dillo is compound data and whenever we accept compound data as input we probably 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 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 00:21:14.419 --> 00:21:19.646 also compound data comes out as output and so, we probably need to call the 00:21:19.646 --> 00:21:23.520 constructor. In our constructor dillo then is supposed to come out the right hand 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 00:21:28.190 --> 00:21:33.239 this stuff down and also actually write down those ellipses marks, the three dots 00:21:33.239 --> 00:21:37.210 and these are building blocks and they are completely mechanical, they have nothing 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 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 00:21:45.740 --> 00:21:50.660 whether the dillo was alive or not before. We're probably, but we are interested in 00:21:50.660 --> 00:21:54.215 the weight in constructing that new armadillo and does it still run over a 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, 00:22:00.250 --> 00:22:04.210 it's an extremely bureaucratic process producing that program. And some of those 00:22:04.210 --> 00:22:08.160 steps are completely mechanical, they might be boring but they enable everybody 00:22:08.160 --> 00:22:14.210 to make progress. And so you might imagine I said rattlesnakes and rattlesnakes are 00:22:14.210 --> 00:22:18.558 very similar to dillos, I'm gonna run over those very quickly. So rattlesnake has the 00:22:18.558 --> 00:22:22.340 following properties: thickness and length. And you can see there's a record 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 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 00:22:30.300 --> 00:22:34.780 do armadillos. There's a couple of test cases and rattlesnakes can run over, you 00:22:34.780 --> 00:22:38.539 know, they get flattened out. So their thickness goes down to zero when they get 00:22:38.539 --> 00:22:43.930 run over. But the important thing is now, we might think about, well, we're just 00:22:43.930 --> 00:22:48.289 going to run over whatever animal comes under our wheels next, so we were 00:22:48.289 --> 00:22:52.039 interested in an animal on the Texas Highway and an animal is one of the 00:22:52.039 --> 00:22:56.000 following: it's either an armadillo or a rattlesnake. And whenever you see that 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 00:23:00.471 --> 00:23:05.530 dealing with something that we call mixed data and so, again, this thing has a name. 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 00:23:09.571 --> 00:23:14.690 program to them. So you define a signature that says, well, animal is a signature 00:23:14.690 --> 00:23:20.360 that's mixed from dillo and rattlesnake and we're then going to write a function 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 00:23:24.220 --> 00:23:28.400 rattlesnake to rattlesnake, it has animal to animal. It has test cases like as 00:23:28.400 --> 00:23:35.260 before and, well, remember that there were two different kinds of animals on the 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 00:23:40.289 --> 00:23:43.850 different thing of running over an armadillo and running over a rattlesnake 00:23:43.850 --> 00:23:47.759 so for that, we need a conditional and we need these predicate function that says, 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 00:23:51.740 --> 00:23:55.400 fill in the gaps. And of course we've written those functions already, so it 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 00:23:59.629 --> 00:24:03.689 very quickly and I've left out a lot of steps, this is an extremely bureaucratic 00:24:03.689 --> 00:24:08.280 process and when you read about this at first you think: "this is so boring, I 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 00:24:13.330 --> 00:24:17.679 if you practice this on your students, surprisingly pretty quickly they go like 00:24:17.679 --> 00:24:21.860 this, because they realize that this bureaucratic approach actually makes them 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 00:24:26.100 --> 00:24:32.421 successful, but then they start smiling. But it took a long, long time to a develop 00:24:32.421 --> 00:24:37.019 this approach. So Matthias has been added, I think since the early 1990s, I've really 00:24:37.019 --> 00:24:42.279 been involved in this process, I think since since about 2001. So really you need 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 00:24:47.000 --> 00:24:53.070 stress this enough: when you observe it is not enough to measure the popularity of 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", 00:24:56.960 --> 00:25:02.429 right, "is that something that's interesting", you know? I've seen a huge 00:25:02.429 --> 00:25:07.090 bandwidth of things where we were unsuccessful, but people just liked it, 00:25:07.090 --> 00:25:12.370 just people just liked it fine and so, this process, you know, we repeated many 00:25:12.370 --> 00:25:16.929 times and hopefully gonna repeat it many times in the future. But it has produced 00:25:16.929 --> 00:25:21.000 the following insights. You need, so it's very useful to have a very bureaucratic 00:25:21.000 --> 00:25:26.490 approach to programming that we call design recipes. I didn't much talk about 00:25:26.490 --> 00:25:30.040 the fact that it's very helpful to have programming languages that are 00:25:30.040 --> 00:25:33.440 specifically developed for beginners or for learners, doesn't have to be 00:25:33.440 --> 00:25:37.269 beginners. And it also helps to have a programming environment that was designed 00:25:37.269 --> 00:25:42.629 for beginners and, well, you can go either to a page called "Program by Design" or 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 00:25:46.980 --> 00:25:51.560 of work and it's usually, it's not enough to just take your professional programming 00:25:51.560 --> 00:25:55.080 language and stick it on your kids. It might be, it might work for trivial 00:25:55.080 --> 00:26:00.399 programs, but it's not going to scale anywhere. So, yeah, well it's about 00:26:00.399 --> 00:26:04.630 growing up, but I guess this one is about growing down. So I think the progression 00:26:04.630 --> 00:26:09.039 really should lead us, from you know, the C and C++ like unsave languages and all 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 00:26:14.509 --> 00:26:18.730 languages and runtimes and finally, we're seeing something like Rust and ATS coming 00:26:18.730 --> 00:26:22.970 up, I really only know how to do this bureaucratic and systematic approach to 00:26:22.970 --> 00:26:28.520 programming with functional languages and if you've watched this closely, you saw 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 00:26:33.320 --> 00:26:39.429 and then organized our programs according to that data. Whether you use a statically 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 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 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 00:26:51.120 --> 00:26:57.169 way of proceeding very systematically. So I think when you're teaching programming 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 00:27:03.460 --> 00:27:09.290 people excited. It really is important to impart practical knowledge and competency. 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 00:27:13.289 --> 00:27:18.000 approach. You might call it bureaucratic if you're German, but to my surprise even 00:27:18.000 --> 00:27:23.844 the Sheldons like this after a while anyway and we should really refocus or we 00:27:23.844 --> 00:27:27.740 need to focus you know after all the exploits we'seen over the past couple of 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. 00:27:33.350 --> 00:27:35.476 Applause 00:27:35.476 --> 00:27:40.769 Angel: Thank you Mike for this presentation. We now have like two or 00:27:40.769 --> 00:27:51.091 three minutes for questions. Please go to the mics one, two, three yourself. Ah, we 00:27:51.091 --> 00:27:53.535 have from there. 00:27:56.595 --> 00:28:00.200 Q: Hi! Mic on? Yes. So coming from a lot 00:28:00.200 --> 00:28:04.720 of the software development world and practical experience probably, delivering 00:28:04.720 --> 00:28:09.539 with other customers, have you got any insights into how people would often do 00:28:09.539 --> 00:28:14.070 teaching by code review, a direction for people to go in reading, to learn more 00:28:14.070 --> 00:28:17.699 about code, learn more about the structure of code, in the way that software 00:28:17.699 --> 00:28:21.689 development often is typically taught? Do you have thoughts on that specifically in 00:28:21.689 --> 00:28:24.730 this? A: So I think it's valuable but in my 00:28:24.730 --> 00:28:29.029 experience it's just not enough, right? So the Sheldons of this world, they're able 00:28:29.029 --> 00:28:32.950 to figure out how to program by themselves, essentially, right? By just 00:28:32.950 --> 00:28:36.710 saying, you know, this piece of code is good. That's teaching by example, right? 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 00:28:40.669 --> 00:28:45.779 it's just not a constructive way. It's helpful, right, to sharpen the sense of, 00:28:45.779 --> 00:28:49.951 and you know, what helped, it sharpens your review facilities which is an 00:28:49.951 --> 00:28:54.830 important part in learning anything. But really, I think, so in my experience it's 00:28:54.830 --> 00:29:01.600 completely crucial to insist that in your teaching methodology, you teach them 00:29:01.600 --> 00:29:04.179 steps that they can actually follow, right? 00:29:04.179 --> 00:29:08.860 Q: True, I agree on that, but in respect of how many modern software development 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 00:29:13.970 --> 00:29:18.731 problem, have you thought about doing it this way, what have you considered, do you 00:29:18.731 --> 00:29:23.740 have any thoughts on that process in teaching people in that process, in that 00:29:23.740 --> 00:29:26.660 duration? A: So for beginners my experience has been 00:29:26.660 --> 00:29:29.360 that it doesn't work very well, right? Q: Okay. 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 00:29:33.659 --> 00:29:37.710 people, you know there are very different, many different approaches and we're gonna, 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 00:29:41.560 --> 00:29:45.520 maybe a little better". My experience has been with the vast majority of students, 00:29:45.520 --> 00:29:50.249 right, is, if you use that as your main teaching paradigm the problem is, they 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 00:29:55.450 --> 00:29:57.850 correct solution and you can branch out later. 00:29:57.850 --> 00:29:59.850 Angel: Okay. Speaker: Does that make sense? 00:29:59.850 --> 00:30:01.850 Angel: Thanks. Speaker: Sorry. 00:30:01.850 --> 00:30:04.730 Angel: Mic 1. No, it's okay. Short, quick questions, please. 00:30:04.730 --> 00:30:08.440 Q: Yeah, well, I hope it's a short question. Thank you very much for the 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 00:30:12.889 --> 00:30:15.620 one thing very popular among youngsters: this is Arduino. 00:30:15.620 --> 00:30:18.759 A: giggles Yeah. Q: It's stick up with C and C++ and you 00:30:18.759 --> 00:30:21.909 get very crappy C code. Speaker: Yeah, yeah. 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 00:30:28.399 --> 00:30:32.489 a popular platform like Arduino? A: So I think I would try to make the 00:30:32.489 --> 00:30:36.459 teaching languages work on an Arduino. I think that's gonna be very hard with the 00:30:36.459 --> 00:30:40.200 really really small ones but with this sort of medium sized one, it's a might, 00:30:40.200 --> 00:30:45.010 actually be, might actually be possible. But yeah, as you point out 00:30:45.010 --> 00:30:49.800 inhales/giggles, there's a bunch of crappy C code running on Arduino. I can 00:30:49.800 --> 00:30:53.889 see the attractiveness of that approach, but it's not one that I personally prefer. 00:30:53.889 --> 00:30:56.750 Q: Could Scratch fill the gap? A: No. 00:30:56.750 --> 00:30:58.610 Angel: laughs Q: Thank you very much. 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 00:31:03.549 --> 00:31:07.989 questions and thanks again Mike for your wonderful talk. The applause... 00:31:07.989 --> 00:31:13.700 applause 00:31:14.540 --> 00:31:17.960 postroll music 00:31:17.960 --> 00:31:36.000 subtitles created by c3subtitles.de in the year 2019. Join, and help us!