How to teach programming to your loved ones

Video thumbnail (Frame 0) Video thumbnail (Frame 1275) Video thumbnail (Frame 2486) Video thumbnail (Frame 4199) Video thumbnail (Frame 5788) Video thumbnail (Frame 7188) Video thumbnail (Frame 8540) Video thumbnail (Frame 9906) Video thumbnail (Frame 12050) Video thumbnail (Frame 14226) Video thumbnail (Frame 16859) Video thumbnail (Frame 18663) Video thumbnail (Frame 20390) Video thumbnail (Frame 21596) Video thumbnail (Frame 22911) Video thumbnail (Frame 24944) Video thumbnail (Frame 26239) Video thumbnail (Frame 27507) Video thumbnail (Frame 30045) Video thumbnail (Frame 31659) Video thumbnail (Frame 32927) Video thumbnail (Frame 34560) Video thumbnail (Frame 37238) Video thumbnail (Frame 38902) Video thumbnail (Frame 42125) Video thumbnail (Frame 43849) Video thumbnail (Frame 45594) Video thumbnail (Frame 48357) Video thumbnail (Frame 51650) Video thumbnail (Frame 53071) Video thumbnail (Frame 54584) Video thumbnail (Frame 60986) Video thumbnail (Frame 62265) Video thumbnail (Frame 63567) Video thumbnail (Frame 64948) Video thumbnail (Frame 67003) Video thumbnail (Frame 68773) Video thumbnail (Frame 71197) Video thumbnail (Frame 72852) Video thumbnail (Frame 74154) Video thumbnail (Frame 75411) Video thumbnail (Frame 78181) Video thumbnail (Frame 80447) Video thumbnail (Frame 82704) Video thumbnail (Frame 84938) Video thumbnail (Frame 86347) Video thumbnail (Frame 87560) Video thumbnail (Frame 89065)
Video in TIB AV-Portal: How to teach programming to your loved ones

Formal Metadata

Title
How to teach programming to your loved ones
Subtitle
Enabling students over example-driven teaching
Title of Series
Author
License
CC Attribution 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
2018
Language
English

Content Metadata

Subject Area
Abstract
Teaching beginners how to program is often hard. We love building programs, and seeing our loved ones struggle with this is painful. Showing them how to copy-paste a few example programs and change a few parameters is easy, but bridging from there to building substantial programs is a different game entirely. This talk is about how to teach programming successfully, through comprehensible design recipes, which anyone can follow, using languages and tools designed for beginners. This approach is probably different from how you learned how to program, or how you're used to teaching. It is more effective, however, as it teaches more material successfully to a broader spectrum of people. It is also more enjoyable.
Keywords Hardware, Making

Related Material

The following resource is accompanying material for the video
Video is cited by the following resource
1 (number) Musical ensemble Computer programming Neuroinformatik
Right angle Functional programming Lambda calculus
Context awareness Robotics Universe (mathematics) Computer science Computer Total S.A. Student's t-test Computer programming Computer programming Wave packet Local Group
Laptop Internetworking Constructivism (mathematics) Computer programming Projective plane Materialization (paranormal) Figurate number Error message Bounded variation Computer programming
Frequency Robotics Web page Projective plane Computer program Machine code Line (geometry) Plastikkarte Loop (music) Computer programming Scalable Coherent Interface
Group action Computer programming Projective plane Computer program Bit Right angle Information Machine code Plastikkarte Error message Computer programming Neuroinformatik
Multiplication sign Kognitionswissenschaft Student's t-test
Group action Residue (complex analysis) Primitive (album) Bit Mereology Computer programming Residual (numerical analysis) Word Integrated development environment Read-only memory Semiconductor memory Robotics Damping Form (programming)
Point (geometry) Context awareness Context awareness Multiplication sign Student's t-test Mereology Computer programming Number Mathematics Integrated development environment Robotics Computer science Hydraulic motor Social class Form (programming)
Cognition Mathematics Multiplication sign Touch typing Student's t-test Term (mathematics) Flow separation Computer programming Cognition Neuroinformatik
Software developer Multiplication sign Software developer Feedback Sound effect Student's t-test Computer programming Structured programming Integrated development environment Robotics Personal digital assistant Order (biology) Social class
Scale (map) Group action Projective plane Computer program Student's t-test Computer programming Process modeling Formal language Computational physics Arithmetic mean Latent heat Algebra Integrated development environment Software Physics Compilation album Social class Integrated development environment Modul <Datentyp> Quicksort
Group action Integrated development environment Moment (mathematics) Constructor (object-oriented programming) System programming Set (mathematics) Integrated development environment Basis <Mathematik> Computer programming Formal language
Multiplication sign Computer-generated imagery Menu (computing) Limit (category theory) Mereology Computer programming Formal language Mach's principle Performance appraisal Type theory Roundness (object) Integrated development environment Visualization (computer graphics) Read-only memory Software repository Operator (mathematics) Revision control Text editor Abstraction Window Resultant
Boolean algebra Rectangle Java applet Multiplication sign Expression Rectangle Number Mach's principle Type theory Programmer (hardware) Read-only memory String (computer science) Operator (mathematics) Revision control Summierbarkeit Resultant
Rectangle Computer-generated imagery Solid geometry Bit Limit (category theory) Solid geometry Rectangle System call Computer programming Mach's principle Read-only memory Revision control Video game Right angle Functional programming Abstraction Algebra Social class
Point (geometry) Morley's categoricity theorem Data analysis Student's t-test Limit (category theory) Electronic signature Rule of inference Flow separation Template (C++) Computer programming Message passing Skeleton (computer programming) Function (mathematics) Software testing Right angle Functional programming Writing
Touchscreen Lemma (mathematics) Data analysis Student's t-test Electronic signature Sequence Template (C++) Computer programming Skeleton (computer programming) Process (computing) Software testing Right angle Quicksort
Counting Data analysis Data analysis Student's t-test Machine code Electronic signature Template (C++) 2 (number) Category of being Word Skeleton (computer programming) Function (mathematics) Statement (computer science) Software testing Right angle Functional programming Quicksort Descriptive statistics Form (programming) Row (database)
Rectangle Connectivity (graph theory) Multiplication sign Constructor (object-oriented programming) MIDI Solid geometry Limit (category theory) Line (geometry) Mereology 2 (number) Mach's principle Read-only memory Predicate (grammar) Revision control Object-oriented programming Computer worm Right angle Natural language Quicksort Abstraction Identical particles Window Form (programming) Row (database)
Rectangle Information Constructor (object-oriented programming) Limit (category theory) Student's t-test Mereology 2 (number) Mach's principle Inclusion map Read-only memory Revision control Object-oriented programming Right angle Abstraction Row (database)
Rectangle Rational number Mountain pass Valuation (algebra) Electronic signature Computer programming 2 (number) Number Mach's principle Mathematics Read-only memory String (computer science) Electronic meeting system Object-oriented programming Functional programming Error message Domain name Rational number Touchscreen Computer program Limit (category theory) Electronic signature Type theory String (computer science) Revision control Hill differential equation Quicksort Writing Asynchronous Transfer Mode
Rectangle Rational number Sine Mountain pass Feedback Computer program MIDI Limit (category theory) Line (geometry) Electronic signature Computer programming Electronic signature Mach's principle Dijkstra's algorithm Read-only memory String (computer science) Revision control Statement (computer science) Object-oriented programming System programming Functional programming Abstraction Descriptive statistics
Boolean algebra Slide rule Rectangle Rational number Zeitdilatation Limit (category theory) Line (geometry) Semiconductor memory Computer programming Electronic signature Formal language Dijkstra's algorithm Mach's principle Read-only memory Personal digital assistant String (computer science) Revision control Energy level Functional programming Abstraction Descriptive statistics
Rational number Boolean algebra Limit (category theory) Electronic signature Computer programming Formal language 2 (number) Mach's principle Read-only memory Object-oriented programming Ranking Software testing Functional programming Abstraction Descriptive statistics Information Key (cryptography) Physical law Semiconductor memory Electronic signature Dijkstra's algorithm Skeleton (computer programming) Type theory Hash function String (computer science) Revision control Software testing Writing Lambda calculus
Rational number Dot product Boolean algebra Limit (category theory) Student's t-test Electronic signature Area Template (C++) Dijkstra's algorithm Mach's principle Skeleton (computer programming) Type theory Skeleton (computer programming) Read-only memory String (computer science) Revision control Software testing Functional programming Abstraction Maß <Mathematik> Lambda calculus Social class
Rectangle Rational number Boolean algebra Constructor (object-oriented programming) Student's t-test Element (mathematics) Electronic signature Mach's principle Database normalization Declarative programming Read-only memory Personal digital assistant String (computer science) String (computer science) Revision control Object-oriented programming Row (database) Functional programming Clef Writing Lambda calculus Row (database) Social class
Dot product Boolean algebra Block (periodic table) MIDI Limit (category theory) Mereology Electronic signature 2 (number) Dijkstra's algorithm Mach's principle Type theory Skeleton (computer programming) Read-only memory Natural number Revision control Software testing Series (mathematics) Abstraction Lambda calculus
Boolean algebra Bit Limit (category theory) BEEP Electronic signature Computer programming Electronic signature Formal language Mach's principle Dijkstra's algorithm Read-only memory Internetworking Personal digital assistant Revision control Software testing Software testing Iteration Lambda calculus
Point (geometry) Boolean algebra Length Multiplication sign Connectivity (graph theory) Limit (category theory) Student's t-test Electronic signature Power (physics) Mach's principle Frequency Goodness of fit Skeleton (computer programming) Read-only memory Natural number Object-oriented programming Software testing Series (mathematics) Abstraction Lambda calculus Boolean algebra Constructor (object-oriented programming) Data analysis Mass Bit Limit (category theory) System call Electronic signature Dijkstra's algorithm Skeleton (computer programming) Function (mathematics) String (computer science) Order (biology) Revision control Software testing Right angle Row (database)
Slide rule Exterior algebra Matching (graph theory) Mixed reality Counting Primitive (album) Electronic signature Formal language Electronic signature Form (programming)
Boolean algebra Limit (category theory) Machine code Electronic signature Electronic signature Mach's principle Read-only memory Mixed reality String (computer science) Mixed reality Revision control Data mining Statement (computer science) Software testing Clef Abstraction Lambda calculus
Boolean algebra Boolean algebra Usability Limit (category theory) Electronic signature Mach's principle Mixed reality Read-only memory Revision control Software testing Software testing Functional programming Abstraction Writing Lambda calculus Social class
Rectangle Rational number Constructor (object-oriented programming) Branch (computer science) Limit (category theory) Electronic signature Template (C++) Formal language Mach's principle Mixed reality Read-only memory Different (Kate Ryan album) Computer programming Object-oriented programming Functional programming Abstraction Lambda calculus Constructor (object-oriented programming) Bit Predicate (grammar) System call Dijkstra's algorithm Personal digital assistant Predicate (grammar) String (computer science) Revision control output Condition number Software testing Row (database)
Computer icon Boolean algebra Branch (computer science) Limit (category theory) Semiconductor memory Electronic signature Ellipse Mach's principle Programmer (hardware) Mixed reality Read-only memory Personal digital assistant Revision control Condition number Software testing Software testing Functional programming Abstraction Lambda calculus
Home page Stress (mechanics) 1 (number) Student's t-test Electronic signature Computer programming Template (C++) Skeleton (computer programming) Mixed reality Term (mathematics) Mixed reality Functional programming Form (programming) Social class
Computer chess Keyboard shortcut Inheritance (object-oriented programming) Link (knot theory) Software developer Computer-generated imagery Set (mathematics) Computer programming Revision control Programmer (hardware) Computer programming Software Integrated development environment Game theory Fundamental theorem of algebra Link (knot theory) Information Software developer Projective plane Computer program Computer programming Software Series (mathematics) Revision control Website Condition number Energy level Freeware Row (database) Address space
Revision control Link (knot theory) Link (knot theory) Software Software Computer program Letterpress printing Musical ensemble Computer programming Formal language Row (database)
Programming language Different (Kate Ryan album) Computer programming Computer programming
Point (geometry) Mobile app Scaling (geometry) Inheritance (object-oriented programming) Student's t-test Computer programming Robotics Different (Kate Ryan album) Personal digital assistant Universe (mathematics) Video game Damping Algebra Active contour model
Point (geometry) Overhead (computing) Multiplication sign Stress (mechanics) Student's t-test Symbol table Revision control Programmer (hardware) Single-precision floating-point format Right angle Functional programming Imperative programming Asynchronous Transfer Mode Social class
Principal ideal Point (geometry) Computer file Java applet Student's t-test Mereology Rule of inference Computer programming Formal language Goodness of fit Structured programming Computer programming Boundary value problem Energy level Functional programming Imperative programming Social class Pairwise comparison Software developer Projective plane Sound effect Software Universe (mathematics) Video game Right angle Arithmetic progression Writing
Mathematics Group action Link (knot theory) Bootstrap aggregating Software Projective plane Computer program Right angle Student's t-test Mereology Algebra Computer programming
Web page Multiplication sign Gradient Universe (mathematics) 1 (number) Energy level Student's t-test Complete metric space Arithmetic progression
Insertion loss Right angle Quicksort Complete metric space Computer programming Element (mathematics) Template (C++)
Cartesian closed category Musical ensemble Semiconductor memory Storage area network
[Music] do you remember some days ago where you sit together with your loved ones and you had to fix their computers and told them how things work and why they are working the strange way they are working imagine you have to do this for teaching them how to program and give them the passion and the love that you have for programming so please let's give max Vera a great applause for his talk how to teach programming to our loved ones
[Applause]
so if you if you're teaching you go booster right you know that if your
audience is is large enough for if you've got super gifted children like you probably all do then you know you teach them just about anything and they will say they will tell you and they will give you feedback telling you how wonderful that was so for example I like functional programming so that's a lambda which stands for functional programming and you know whenever I teach that to a sufficiently large audience some some got somebody typically looking like that would come up to me and tell me oh this this is lambda stuff this functional programming stuff that's the most wonderfulest thing I've ever heard and you're a great teacher and so in the introduction it said
something about a couple of days so I think I've been teaching for thirty years now in various contexts to high school students to university students
to kids to humanities majors to computer science majors to computer science minors and professional training to coworkers but if I take the totality of my teaching experience most of that overall looking back was a failure and I want to talk about those failures more about the successes that come from the passion so if you look at initiatives
that aim at fostering programming skills among children for example they always
talk about getting people excited and sort of exciting their passion for for programming and you hear politicians talk like that a lot - we need to get young people into technology because that is the future I'm not sure about that personally but it always seems to end up in classrooms that look like this that typically have a bunch of robots in there sold by some company and that are supposed to because robots are for some reason inherently interesting they're supposed to get kids or whomever
interested in programming excited about programming and that's all good and well also I think there's this underlying assumption that only if we would get people excited and interested in programming they would sort of acquire
the required skills by themselves in some Perl as of trial and error or osmosis or something like that and I think the most prominent project that propagated that notion some of you may remember was this one laptop per child initiative a couple
of years ago and you don't I haven't seen many of those at this conference and the reason for that is that the educational concepts around one laptop per child were based on this idea of I think what's called constructivism this idea that only if you give children
enough material and access to whatever the Internet and teaching materials then they will all figure at all all themselves and they will figure out how to build programs by themselves and I think one of the underlying problems I mean there were many problems with all a PC but one of the problems was certainly that just this approach to the DAC takes and pedagogy doesn't work particularly well and you find variations of that
pretty much every year there's an
educational initiative built on this notion of inspiring you know passion for programming you know last year you could hear about a project called Bob which essentially is about programming a little a little robot like device that has blinking lights and things like that and certainly very interesting and you program it by I think you can see that
here you program it by essentially downloading already somebody's already programmed some C++ code for you and you take some line in the middle and change it to change the blinking through frequency or something like that and again all that is good and well and I don't want to denigrate that but it's all good and well for inspiring passion but all of these projects all these projects have in common is that they are not really about teaching the methodology of programming and so this is you know this is what this talk is about and it's probably going to be the most boring talk you've ever heard if
you want if you want to inspire a passion for programming and for for computers there's lots of projects right outside this door specifically today on the young hack attack that will tell you how to do that the problem is that if you want to
transition from these projects to actually serious substantial programming projects that your learners want to undertake by themselves and if you look closely enough you will find that a lot
of people get frustrated by that experience of writing more complex programs and even if they do not get frustrated their code often ends up looking like that on the right hand side and so so of course this entire conference is in the spirit of tinkering and building things by trial and error and you see a lot of things that look like this but you know in the upcoming IOT apocalypse maybe we want to have a little bit slightly more methodical approach so the problem is
really that most didactic approaches to programming do not work very well and I for the longest time I really didn't have a good explanation as to why that was and why maybe the stuff that I was doing or that I learned how to do over the years work better and so finally I found a fun a great book that confirms some of my biases that I read to just the day before yesterday as I was preparing this talk and it has a couple of cognate so written by a cognitive scientist Daniel Willingham and he lists a couple of principles that
are active when students learn right and I think one of the things that's really important is that we all have this idealistic notion that everybody loves to learn right but in fact learning is quite a difficult activity and it's quite straining and so even though people are curious about things and they love to look at things and they like to have successful learning experiences if
that learning experience means they have to think hard then at least some people shun those same experiences another problem is so and that's that's of
course a problem when you transition from a primitive programming environment like scratch or Bob or something to more complicated things that you easily get frustrated and then shun away from the learning experiences that are required to take the next step another one that I found interesting is so these are just all the cognitive principles in that book so gonna be very very textual and boring but I liked it so much so it says factual knowledge precedes skill but if you think so what it means is really that you need to have that if you want to learn a particular skill you need to associate that with factual knowledge but if you think about the factual knowledge that is associated with programming then a lot of the principles underlying our everyday programming skills are usually unnamed and they're not really put in specific words and so they're not in the form of factual knowledge and which is why a lot of people have trouble with the skill part I loft this bit which says memory is the the residue of thought which is that we don't always remember the things that we should be remembering but that we remember things that we spend a lot of thought on and that means in particular for educational initiatives that are centered around robots or something that's really that is supposed to take over the passion part of programming but not really central to the activity of programming people tend
to think about the robots they tend to think about the motors and actuators and things like that those are worthy skills in and of themselves but they don't contribute much to the actual skill of programming I remember asking a proponent of such an educational initiative a number of years back you know what is it what is the skill that students take away from your from your robot class and he said well after that class where they spend all their free time for a semester or a year they really know what pi is and I don't know for me that is not enough so another thing is that maybe that doesn't go so
much towards computer science or programming experience but but also to move the way that we do math education is we understand new things in the context of things we already know and particular we find it easier to answer understand concrete things and I think both in both in math and computer science a lot of explanations are in the form of explaining some abstract thing rather than showing how to do a concrete thing and so we'll get back so this is going to be a major point later on something that didn't really need saying in that book proficiency requires practice so if you want to get better at programming you need to practice it with the goal of getting better at it so in the classroom or in a teaching environment you really need to create situations that foster successful practice the successful solution of problems so that you know there's natural curious part in the beginning so so students so people generally derive a
dopamine rush from successfully solving problems so we really need to put we really need to put our students in a situation where they can successfully solve problems that are not too hard and also not too easy because if they're too easy that I mean rush will not be big enough here's a trap I think that most most
people who teach programming know about is that cognition is different early and late in training and if you're here most people in this room are late in training so we've been in touch with computers for a long time so our cognitive processes when we think about programming are different than the cognitive processes of beginning students sometimes it's also called the curse of knowledge so just because we find some piece of material inspiring or interesting or some technique of explaining something very persuasive that does not mean that our students find it similarly persuasive and find it similarly easy to follow along our teaching if you're teaching big classrooms I think there's being have been a big push towards individualistic learning and of course that's wonderful on the other hand our children tend to be quite alike in their style of learning and so I'm not gonna be talking about that much to that very much today but there's still great value and having a classroom with several students that are all being taught the same thing not a subject today but I could also that also has been confirmed by experience generally some people think that you know some some people are good at math and some people are bad at math you know girls are always bad at math for some reason and it turns out that this is well first of all it's not true and even if you feel you're bad at something then usually what what we call intelligence can be changed through sustained hard work I think you know 10 or 20 years ago
a lot of people believed an IQ that in an innate ability to learn things but it turns out that that most of the effects of IQ on your ability to do things well are quite indirect and through the environment rather than through some structure in your brain that you were born with and so that's something that
you really learn when you do thirty years of teaching is really that your teaching can improve over time but in order to improve you really must get feedback and you must practice it and get feedback the same way that the skill itself must be practiced and that sometimes gets you feedback that is well surprising sometimes and also it's often quite quite pain full because sometimes you get the feedback that you're teaching just did
not work so really I want to aim a programming education at a diverse audience and not just I mean if you look at the robot class if your student population that ends up being in that robot class is really as diverse as you like it as you'd like it to be I think often that is not the case so the stuff that I'm gonna be talk about that I'm going to talk about has been applied not always by me but your children to high school students University students to professional developers and works quite well and what it is based on is a set of
systematic methods and I'll try to show you in great and painstaking detail of what that means and so here are some
references that you can look at and particularly build on the work of the PLT group in the u.s. led by Mattias fellows and we have a great book out and I'll give you a reference to that later there is a there's a significant project for teaching high school students in the US and there's also a project that I'm involved with what's called which is called Dyne program which tries to be sort of the little German sister of that stuff so one aspect that's important to
this method of teaching is that all the tools that we use are geared towards learners in particular that means that there's a specific programming environment that was made specifically for learners rather than your Emacs or VI or whatever your favorite thing is that you want to that you want to inflict on your learners I don't think you should I mean Emacs person myself so also what it means is that we have that we use specific programming languages that are derived from real programming
languages but then have been modified to be especially especially suitable for learners and also then we have something called the design recipes which are which are a set of methods for systematic program construction that try to provide this factual basis for the methodology of programming and so there's programming environment loaded for free and so there's a great system called racket develop developed by the PLT group but there's a tiny corner in there that I'm going to refer to today which is great for many things it was originally designed and still is great for teaching so so let me try to switch to that I hope that works out this moment always scares me so here is
the system called dr. racket and you can
see it has it has not very many buttons it does not look like eclipse or Visual Studio or something like that does not look like a professional programming environment and the way this works and I'm gonna try to show you how it works is in the upper part of that window there's just a program that's a text editor with a couple of special features not very many and down here is the repple which you can use to interact with the program that you've written we're gonna be using that very much but what you can do in the repo and the beginning at least is you can just type something and it will give you it will immediately tell you the result of the evaluation of what you typed in and now you would have to remember it's this is going to be alien and strange to you but the way this works is these languages are based on Lisp so they use round
parentheses a lot and specifically when always when you want to put something together they have round parentheses and they have the operator in front and you especially if you from the programming for a long time you think oh no this is I'm never going to get used to that but I can promise you your children will
have a very easy time dealing with this so you could go and say you know you could just type a number and it will give you the result you could type a
string you know Mike it will give you the result it you could go and you could you know you could combine numbers right by adding them together you could let's go away with that looks like this so that that's what it what it looks like a compound expression is always parens around it and the operator in front so you don't really say you know this number plus that number you say the sum of those two numbers okay and so gives me the result of that what's kind of fun if you're a C programmer or Java programmer this is kind of fun but children love this for some reason I don't know so what you can also do is the same way that you're used to having numbers and strings and whatever in boolean be values pictures are also values so that sometimes helps when you're trying to drum up that little piece of motivation that you need so you could do like a rectangle that is solid
blue and that's a value and whatever whenever there's a value you can write a program that binds that value to a name by writing defined so you could do something you know really exciting like this you would define PI for something we could run that program and then we could put top PI here but we could also do you know our that rectangle and whatever 50 solid red and we can run that program and here's that rectangle what's maybe more interesting is that we can maybe do another rectangle you know that's solid blue and you can also see here's the same principle at work right parenthesis around the define so the define says it's a definition at the
rectangle is just a call to a function that comes with doctor racket and it's also in front and so I could do that now I have our I have f2 and I could also do things things like you know there's for example a function that takes two pictures and puts them beside each other so there's a little jumping ahead a little bit there's a little algebra of pictures in here that you can use to program video games for example later in the class if that's something that you want to do so this is not entirely without motivational examples so there's that you know let's let's see how far we can go from there okay so but getting
away from those motivational examples in German were very big on traffic rules right Dawson you salt milk so there
are many rules right and we'll try to model that this is going to be make this the most boring talk you've ever heard
so we're going to categorize German traffic violations so in particular there's two kinds of traffic violations there's red-light violations where it's important where they happen and it's also important what the duration is how long after all the light has turned red passes before you actually cross the intersection or the the red light and then there's a speeding violation where you also have a place and you just have how many km/h did you go over the limit and we want to write functions and I'll tell you how to do that for e for healing the place of a violation and classifying a violation as serious or not and for that purpose we're going to do use something called the design recipe or rather as there's we're going to use several design design recipes and first of all there's an overall design recipes where it says how you write a function and please don't fall asleep there's one two three four five six eight eight steps to this and we always ask our students to always go through those eight steps and you think this is all I mean I hope you do right you feel this is this already looks like the most boring is you know exposition to programming ever this is like the German bureaucracy approach to teaching how to program on the other hand so so but you know it works that is the point specifically each of those steps is something that is small enough so that students can usually successfully do it and if you can reward it with credit or candy or whatever then you know students will be motivated to get to the next step you know if you've ever taught unsuccessfully and probably
most of you who have always taught successfully but would always happen to me is then when my teaching would be unsuccessful my students would be staring at a blank screen right and that would give them this problem and I felt this problem was really solvable and they would give up before typing the first key right they wouldn't know where to begin because there's usually most approaches to teaching how to program our example based they give you some example you know here's that program solves that problem now here's a different problem they'll solve that and you already saw how that's done and that process usually or often does not work and so this fixed sequence of steps gets students over that hump and I'm gonna try to explain that really in painstaking detail because the books don't really do justice to a whole bureaucratic and painstaking it is so you'll all have the benefit of that so there's always these eight steps and then there's more instructions that come with each of those steps right but these instructions are eminently learning all and that's the important aspect here so in particular so I'm going to sort of
jump in right ahead oops ah you see something that I don't see
there we go so if you look at this problem statement
so so it says the first thing that you
do is well you do a short description of a function we already have two short descriptions of the functions you know find the place of a traffic violation and find out if it's serious or not and then it says please conduct a data analysis and data analysis means that you look at the entities in your probe in your problem and and analyze them and
here it says well this is all about traffic violations and it says something of the sort that there's for example a red light violation and it says that red light violation has place and duration and that duration is in seconds so one
thing that you can do is you can look at the wording of how that data is described and if you discover wording that says you know this thing consists of these pieces right or this thing has several different properties this is a phenomenon that we call compound data and that has a special design recipe that powerpoints and I'll threw away see okay it comes up again so it says well you recognize compound data by a description of your data that uses words like consists of or has and then you write a definition data definition of that form and I will show you how that works then something really trivial comes you count the ingredients and you may write it what's called a record definition that's actual code and then you ensure that the counts match and you know these are instructions in the textbook right and and students learn to memorize those instructions if you all you're all going a sliver you know you're all falling asleep but sorry about that um so let's see where's the
right window here's the right window so that's what we were doing right I'm gonna well I'm gonna leave that year for your entertainment and says we're all a red light violation I'm so excited I
need to talk and we said it has this formulation it says has and we're just going to write it down and it slightly more systematic way so it has a place and it has a duration in seconds right and that's just a piece of natural language and those semicolons they make this a comment okay so we didn't do much except writing each component of our compound data in a separate line and then it said I can't really display it at the same time then it's at write a record definition and that record definition has this form and it really it looks a little tedious but it's actually quite valuable so it says we're talking about red light violation so we give our thing a name so that's called red light violation red light violation then we will need to create red light violation objects so we will need a constructor so I'm going to write down the name of that constructor eventually we will need to distinguish red light violations from other things so I'm going to write something that's a predicate that will use a little later and then we have two parts and I can't emphasize enough how important it is that you sort of remember to write it has two parts because it says that there's a place in a duration in seconds and we write the names of things that will extract those pieces so we go here it says red light violation place and red light violation duration or we could call this let's call it second so we always know what that is and now what
that does is when I run it as well it doesn't do anything but what we can do is we can now create objects that represent red-light violations and so what we could do is well let me first show you how it's done we do make red light violation you know there's one in bork somebody you know had a red light violation for four seconds in Bourg right and then it will display a record value that shows what the parts are that we had and so I can copy this up here and call it and make an example out of that and so like this and so now we have our v1 here so this is what's called a constructor and this constructor only call it creates this object and this object really creates data that is associated with information so that's an important aspect to explain and so usually we ask students and I can't I'm not writing this down to explain it to
you I'm writing it down to show to you what to expect from students and so you go ah make them do it so this is a red light violation and
Bourg you know four seconds four seconds so it it seems really trivial to you but it's important to really to link the program to the problem domain that we're in right so we have a minor red light violation here am i spelling this right anyway so here we go and one way to talk about this new function that we created make R it light valuation is writing down something that we call a signature and look sort of like a type type signature but isn't quite that's something that we did specifically for teaching so you do make red light violation and remember in math you would sometimes write F Delta F colon to denote a type and here we just put the colon in front so it says make red light violation well it takes a string that says what the place is it takes some rational number that says how long it went how long the red light violation was over the limit and it creates a red light violation object so that's not going to do much unless whoa let me let me show you something if I wrote something else here I wrote a number here something blue where'd it go so it's so it says it gives an error message here and it's I think it's do this full screen mode for some reason let me see
if we can do this again no not quite
okay now we know what it is so yeah it was so when you unfortunately this in German so I hope some of you read German I'll try to translate it says well this program still has to be tested but it says there was a sit so it says here Cygnet will find that song which means signature violation and it says I got five and there in this line here and really so this is the five oops right here in this line and it violated
the signature here so it gives you so the system that's one aspect of what makes the system specifically designed for learners is that it gives you very specific feedback as you run the program okay so let's do away with this let's get this down here so now one of the challenges or one of the problems and problem statement was to write a function that determines whether a red light violation is serious or not and so when we do that it said well you put a short description in front and so here's
a short description and there are lots of religious wars about how many comments you should put in a program but to our learners we say put one line not more not less in front of every function and that's usually about the right level so is a red light violation serious so
the next thing is well if you remember that slide it says well if you're writing a function if you're implementing a piece of functionality that always ends up being a function of functional programming you write a signature for that function that talks about what goes in and out of that function so in this case we what we have to make up a name for that so practically writes itself here and so we just put so in this language you can put a question mark in the middle of the name and you can also put hyphens in the middle of the name and what we want is we want a red light violation to go in and we want a boolean to come out that says whether that violation was serious or not so those are already steps in that design recipe that you saw and so if you're in a classroom situation or whatever you can give credit for each immediate step and you should because
those are already those are all small successes in in your programming and ever so the next thing that you should do is you should write examples or tests those are almost the same thing here and so fortunately we already have examples of red light violations so we just have to write down how we expect our function to behave with respect to those examples so there's something called check expect
and I hope you recognize that principle that were that things are always named in the front so we could say red light violation serious with children you might want to pick shorter names if they can't type that fast yet but with grownups this this works so the first one is forceful four seconds over so that's pretty serious so we expect that to be true and that hash mark key means true and so and you and the other one is half a second over and that's not so serious under German law that's fine okay so the next step so now we've written so let me let me label those things right this is the short description this is the signature these are the tests and now you write something called the skeleton and the skeleton is just you start writing the function but you already have some information about that function you know the name of that function it you know how many things come in and out in and out so you write oops type we're here so and well this is a functional language so somebody always has to write lambda somewhere so when we make a function in these languages we always write lambda so we want to make a
function that accepts one thing and that is a red light violation a red light and we'll just call it our LG and and we'll
just put three dots here so the three dots I don't mean to say we're gonna fill in the rest later it means in class
when I do this I actually type three dots and in class especially at the beginning we actually ask our students to type the three dots because this is the skeleton this already gives you credit and it's it's you know since this is so easy to do it really means that
there's you you're not staring at a white piece of paper and maybe you'll feel encouraged to do that next step now the next step says you have to fill in what's called a template and those
are elements of the function that you're writing that derive from the data that goes in and sometimes from the data that goes out in this case the data that goes in is one of those red light violation objects and that red light violation object if you remember is a compound object it has two pieces and whenever you write a function that accepts compound data with two pieces you probably need to look at those pieces so what you do is you write you have to write something that will tell you what those pieces are and remember so I'm actually told you how that works but remember here was the record definition up here and it told us and we have a signature there that tells us how to construct a red light violation object and so what we also need is we need a way to get the components out of a red light violation object so we need what's called selectors or accessors and those are the things and parentheses here and here and you can also describe them with signatures and strangely enough so and here a red light violation thing goes in and a string comes out and and in this case a red light violation goes in and a what did we say irrational comes out so those are of course those signature declarations that are redundant you don't have to put them in they're
redundant with the constructor declaration and you're going to sleep but you're going to sleep anymore even more probably than you were but I had an epiphany in class where I would only write the constructor signature and the students would ask me to also write the accessor signatures and so they made me even more bureaucratic than I was
already by then I already was by Nature so now here what we do is we want to get access to the different parts so we write red light violation place of rlv so that's one piece violations seconds of ROV that's the second part and those are building blocks so really if you're really strict about it you might have people type you know three dots in here also so these just say these are building blocks for your function and so you think about how those parts contribute to the answer to your question so the question was is the red
light violation series or not and then you can think about well it's a place relevant whether it was serious or not and in Germany I think it's not but it is relevant how many seconds you went over so you then have then you go through this conscious act of you have you've written it down but now you delete it again because you've done a
little bit of thinking and you go and well then you look up I look this up on the internet if it's over one second then or if it's one second or over then it's serious and then you delete all the ellipses and make sure all the parentheses close and then you run the program and ah here's still the signature violation that we need to fix so and we can so it says here again there's a little German sentence this beep sentence because these languages were designed for Germans and it suppose both tests were
successful because we wrote two test cases here okay so when this bureaucratic approach just goes on and on so I'm just gonna go through the second iteration more quickly so it said you know what did it
say it said said this we also have a speeding violation so let's go through
the motions so that a speeding violation has again it also has a place and it has you know how many kilometers per hour over and we write a record definition something like this and we could do you know - speeding vile so so now we have a data definition that says oh we've got two components we've got a record definition that needs to match that you all think this is trivial but with compound data students who often have trouble so it serves Welch it serves you well to remind them that there's two pieces and those two pieces need to be selectors in the record definition so we have speeding violation one speeding violation you know out on Main Street you know what twenty kilometers over and we have another one you know low Street or whatever that is 25 kilometers over so there's two examples right and we have one on low street 25 km/h over limit so once again the speeding violation constructor has a little signature that says well natural number goes in speeding violation object comes out and so we go through those same notions I need two things in order to demonstrate one more thing so then again the question was when is this when is a speeding violation serious is a speeding violation serious and of course the speeding violation goes in and a boolean comes out and so we will write two tests so speeding violation in Germany is serious when it's 21 kilometers an hour over the limit or over that right it gets progressively more serious after that so so the first one is not too serious will not get you any points in length bulk but the second one is so and once again we go right speeding violation series we write the skeleton so then we write the skeleton then we fill in the gaps and says we really should be writing like calls to the accessories so we have the place of the speeding violation and we have the kilometers over of the speeding violations and then we think a little bit and then we realize oh the place does not matter so I'm skipping of course this all goes on usually over a longer period of time that you're teaching so I'm going on going pretty fast here so we do away with that and we go well this really if this is over 21 and that's bad um okay so let's see if that works let's just kilometer power over so and then it says all four tests are past so that's good so you know there's
primitive data there's compound data you may have noticed that on the slide it said a traffic violation is either a red light violation or speeding violation so that's not compound data when you see this formulation in your language that says it's this or that or that or that or maybe it is one of the following then you're not looking at compound data you're looking at a phenomenon called mixed data so you've seen this you've seen this you've seen this mixed data so
you recognize it by either the words or or one-off and you write a definition data definition that really has that form you count the alternatives just like you do with compound data you write a signature definition I'll show you how to do that and you ensure that the counts match and so the way that you do that is this we set data definitions so
we said a traffic violation is one of
the following it's either red light violation and/or it is a speeding violation and just as with the compound data this little data definition has some code that goes with it so we'll just call this thing a traffic violation and we just use define to say what that is and define traffic violation is just a signature that says it's mixed it's mixed data from red light violation and speeding violation so here you go so now we can use that in signatures you remember the problem statement didn't say find out whether a
red light violation was serious or a speeding violation was serious it said find out whether a traffic violation is serious so you know is a traffic
violation but so far we only have functions one works on red light violations the other one works on speeding violations but they don't work on that mixed so we'll try to do that now and instead of writing red light violation will just write traffic violation to a boolean and so and we could now write tests that match those that are there but I'll spare you that but in class we absolutely wouldn't need to do that and now what we do is when we have a traffic violation remember how I said if you have compound data you put
calls to the accessors in the body and then you will on from there but now we're looking at mixed data in the input so mixed data has a different template and that template says well if you're looking at mixed data that may be this or that or that you should probably find out what that is before you do anything else and for doing that we use a conditional
we use something like so so what we need to do is we need to distinguish red light violations from speeding violations so we need some function that will tell us which one it is and this is the last bit up here in the record definition you remember that we set read violation here at red light violation here this is the name of the constructor so was the constructor these are the accessories and this is what's called the predicate and the predicate tells us whether a thing is a red light violation or not so in this case the predicate says red light violation question mark or bad or @p is what the programs in these languages say and it takes anything and it tells us whether it is a red light violation object or not I'm just going to copy that down so that we remember well almost done so and of course the same thing goes for speeding violation so we need a conditional that has as many branches as we have alternatives in
the data definition and again you think this is super trivial and childish but it works very well for making successful programmers so we need two branches and the way that works is this so you write
this out with ellipses and then you need to come up with tests for the two branches and this in this case the tests are is something a red light violation or is it a speeding violation so we have this question mark TV and we have this which says speeding violation TV and so the good and now here we just need to put in the answers and the great thing is we already have the answers we
already have two functions that tell us whether a red light violation is serious and so we can just call that here and we can do this here so and then we're done so I think that's all we can do in this hour that we have today so I hope you'll see two things first of all this is super boring and super bureaucratic but
maybe you can see that every single step that we have here has is a principle that has a specific name and that you can explain and very specific concrete terms that are not abstract and that means it can really explain every step that's needed to solve this problem and I can't tell you what a game-changer to
that is for teaching if you really ask yourself if you know when you when you present an example to your students whether you can really explain every single step and explain to the students here's what you should have thought you know here's how you should have picked what to do next that usually ends up badly so so one of the principles behind this style of teaching is really to be absolutely sure every single step that you expect your students to make when they solve a problem has a name and has been explicitly taught in your class so every technique has a name you will notice me saying compound data and mixed data and design recipe and template and skeleton and and so this is the factual knowledge that we use that precedes the skill that we want to then induce if you're teaching a class that has rewards you reward every single step you really insist on form I also can't stress this enough so on our homepage you find a paper paper that says form over function we don't accept any program that is correct we just accept the ones that match the form that you've seen we also measure success you know you really need to look at how well your teaching style is doing and you improve it continuously so those are the important principles you might think that this stifles
creativity and I really don't think that's true and I think that is based on a misguided notion of creativity so if you talk it successfully creative artists they really also rely on a set of named techniques that they use to tackle a creative problem and so some always says Mozart you know Mozart never had to learn or practice before he got to be a great composer but Mozart started so early in childhood that he had his 10,000 hours of practice in there to be before mostly people even start so this works for so this has been
proven to work this approach for children I think I would start about 11 years beginning programmers it's worked for programmers that learned some other via some other approach you know bad habits and professional developers
there's two websites that you can go on to get more information one is our American chess sister project called program by design that has lots of material links and publications the doctor record software that I showed you and there's also a book in English how to design programs and it doesn't say that here but that book is available for free online but there's also print version and similarly if you're looking
for German language material there's dine program de which also has links in publication links to the same software and the draft version of that book is there too and hopefully we'll have a print version of that also next year and that's all I have for you today thank you very much
[Applause] [Music] [Applause] thank you Mike father talk if you have
any questions we do have the microphones lined up here and let's go and in that row and that's the thickness yes the signal angel has a question for example - which was also developed for teaching
so Python is definitely not developed for teaching not in any meaningful way
so in practice in practice I think the fundamental difference but there's a lot of educational initiatives around Python the thing is really that if you try to name and and really formalize the techniques that systematic techniques that I showed you and apply that to Python programming you will find that very hard I personally found it impossible most Python programs out there in practice are just not developed systematically and I don't know how to do that and so that is where that is much better this corresponds these programming languages were were designed in lockstep with the didactic principles that underlie them and as far as I can tell I'm sorry about that Python was not developed with any didactic principles in mind whatsoever sorry okay then microphone to please
good enough yeah I teach roughly 14 years old in the middle school and also programming and I use the App Inventor right now the App Inventor MIT Media Lab App Inventor French and I I'm not sure you you said okay you need to buy Lego Mindstorm robots and stuff
like that or scratch or MIT App Inventor that's not the case yeah what I find difficult for students I have there they are not the best from the best parents that they would like to show something in the end and it's your programming looks a lot like super high school it is really very boring and how how to bring over that point variable that in the end they can show it on this month yeah depending on your target audience of course you choose different examples and that this example just had a lot of things you might have seen me show the pictures that is show the picture algebra at the beginning so that's something that tends to work great for children and older children alike and that scales all the way to writing videogames and there's an entire book that shows children or young people on how to do that so that's one of the great aspects of this I think that's the fundamental difference to things like scratch and so on this approach to programming scales all the way to program into professional programming and it scales to substantial videogames so so the students that we so we always used to do that the halfway point in the first semester at the University and they were able to write a complete like eighty style you know Frogger or snakes or something like that that look pretty fancy and that's something I think that your children could take home okay then
microphone one I thanks for your talk I'd like to know so your approach adds a lot of let's say overhead that is also necessary to be taught how do you go about the methodology in the actual classroom though yeah do you also have some recommendations on how to tackle the actual instrument design of the of the class what methods do you use do you use a flipped classroom mode of what do you do at that point so mostly the classes that I have taught they are taught just like what I did just now so I try to demonstrate that to really make that clear because it hasn't really been documented I could refer you to friends of mine who've taught a flipped version of that which also seems to work quite well but the important thing really I can't stress this enough this as a teacher and I skipped a couple of corners just now to fit in the time slot was that you go through all of those motions that you always go through all of that motion and that's a great tool not just for giving every symbol single step a name but also for pacing the classroom and that and the rest kind of tends to fall in place has been my experience right and no matter whether you're looking at you know beginning students or professional programmers I'm not sure I answer your questions but if you can take the rest offline thank you microphone 3 please yes I think this is very great but it is
teaching functional programming and many people will very soon need imperative programming how do you do the switch or can you do it so I I will dispute that
but well if you want to get paid so thank you so I run a company that does all their software projects doing functional programming ultimately you will need to talk a lot effects the thing what this does really is I mean if you're writing software professionally you know no matter what the language is large parts of that should be functional so this is a great way to teach good programming discipline and a lot of programs out there don't show good programming discipline so I think this would be great to improve upon that so what this does is it pushes the boundary right to be honest I have no idea how to teach systematic development using imperative languages I don't know how to do that I don't know how to do it and I don't know how to teach doing it on the other hand what I can do that you hear is I can push the imperative parts of the programming to the fringe and make them less important for the success of my project and for the structure of my project so yeah so it you should it this is a good thing because we know functional programming works well and we know it is a good foundation for an educational discipline and yeah I can't I mean there are there are various courses that build upon this but ask me offline about that that tackle file imperative programming
okay then microphone four please yeah I'd like to thank you for your talk to and I'm curious what's your experience how many repetitions do you need to teach your students until they are settled with principals do you teach like three examples or is it up to ten make sense I'm not sure I have a solid rule for that so my experience has been so I think every principal here usually has like two in class examples at the university level and then has maybe three or four examples where they do exercises and that's usually enough but your experience might vary I don't I don't think I have a good role for that generally you might not have gotten for this but so the point of comparison and where I have the most experience is at the university level overall the progression of material in here is really really fast compared to your traditional Java course so you can cover a lot of material using that I'm not sure how many how many you know University students or university courses have successful video games in the middle of the first semester and then our nice programs that are well structured so so surprisingly maybe even though this is so boring and tedious it allows you to write program successfully quite fast and and also goes allows the teaching to go quite fast okay microphone two please hello thank you for your talk when I
learn programming as a kid right young and I think that I could transport the tools and the mindset also to mathematics and done do so but yeah a problem solving so I just wanted to ask if in your experience can children also
use the systematic way of solving I mean do they really make this transition can are they getting better at solving problems so if you look at one of the three projects that I listed was the bootstrap project which is which is aimed at high school students or middle school students and they're the the approach is specifically tied to the algebra part of mathematics and so this is where you find exactly what you're looking for and that's been that projects been used usually suspects for successful and they have lots of material on how hot should be taught so that's great stuff okay we have two more
minutes and two questions so microphone one please hi how do you measure success in your teacher so mostly at the university level we look at the final exams and we have a few papers out that are referenced from the webpage there that's I mean usually what we do is we have pretty close supervision even at the university level so we look over student's shoulders all the time to make sure that that we're teaching them at the appropriate level in the appropriate pace but over the years we've seen measurable improvements by looking at the final exams and very specific ones so we don't just look at the overall grade we look at individual problems and see how the progress has been and what we expect and there's papers out on that and microphone for appease it as some
kind of out of completion in your editor or do you not advise us to use this feature for beginners no there's not
auto auto completion as far as I know I'm not sure I would advise against it I know that my American colleagues they've expending as you've noticed right the templates is sort of always recurring program elements and you could imagine there being a button that inserts that program fragments and and our American friends they experiment with that and they came out not using that in practice anymore but I can't tell you details on how that is but if you're interested you could send me email and I could find out so for some
reason so I can't tell you why and I'm not I'm not ideologically opposed to that but we're not doing that okay then Mike thank you for that very enlightened talk and give him a big applause for that talk [Applause]
[Music] [Applause] [Music] [Music]
Feedback