< Return to Video

35C3 - How to teach programming to your loved ones

  • 0:00 - 0:18
    35C3 preroll music
  • 0:18 - 0:21
    Herald Angel: Do you remember some days
    ago, where you sit together with your
  • 0:21 - 0:27
    loved ones and you had to fix their
    computers? And told them how things work –
  • 0:27 - 0:32
    and why they are working the strange way
    they are working? Imagine you have to do
  • 0:32 - 0:36
    this for teaching them how to program and
    give them the passion and the love that
  • 0:36 - 0:42
    you have for programming! So please let's
    give Mike Sperber a great applause for his
  • 0:42 - 0:46
    talk "How to Teach Programming to Our
    Loved Ones".
  • 0:46 - 0:52
    Applause
  • 0:52 - 0:53
    Mike Sperber: Thanks so much for that
  • 0:53 - 1:00
    introduction. Let's switch slides back.
    Speaking of passion. So if you're teaching
  • 1:00 - 1:05
    programming, that's a great ego booster,
    right? You know that. If your audience is
  • 1:05 - 1:10
    large enough or if you've got super gifted
    children – like you probably all do – then
  • 1:10 - 1:13
    you know, you could teach them just about
    anything and they will say, they will tell
  • 1:13 - 1:17
    you and they will give you feedback
    telling you how wonderful that was. So for
  • 1:17 - 1:21
    example I like functional programming, so
    that's a lambda which stands for
  • 1:21 - 1:26
    functional programming. And you know
    whenever I teach that to a sufficiently
  • 1:26 - 1:31
    large audience somebody typically looking
    like that would come up to me and tell me:
  • 1:31 - 1:35
    "Oh this lambda stuff, this functional
    programming stuff that's the most
  • 1:35 - 1:42
    wonderfullest thing I've ever heard. And
    you're a great teacher." And so in the
  • 1:42 - 1:45
    introduction it said something about a
    couple of days. So I think I've been
  • 1:45 - 1:51
    teaching for 30 years now; in various
    contexts: to high school students, to
  • 1:51 - 1:55
    university students, to kids, to
    humanities majors, to computer science
  • 1:55 - 2:02
    majors, to computer science minors, in
    professional training to co-workers. But
  • 2:02 - 2:06
    if I take the totality of my teaching
    experience, most of that overall looking
  • 2:06 - 2:10
    back was a failure. And I want to talk
    about those failures more about the
  • 2:10 - 2:16
    successes that come from the passion. So
    if you look at initiatives that aim at
  • 2:16 - 2:21
    fostering programming skills among
    children for example, they always talk
  • 2:21 - 2:26
    about getting people excited and sort of
    exciting their passion for programming.
  • 2:26 - 2:30
    And you hear politicians talk like that a
    lot, too. We need to get young people into
  • 2:30 - 2:34
    technology because that is the future. I'm
    not sure about that personally, but it
  • 2:34 - 2:38
    always seems to end up in classrooms that
    look like this: That typically have a
  • 2:38 - 2:44
    bunch of robots in there, sold by some
    company. And that are supposed to, because
  • 2:44 - 2:48
    robots are for some reason inherently
    interesting. They're supposed to get kids
  • 2:48 - 2:52
    or whomever interested in programming,
    excited about programming. And that's all
  • 2:52 - 2:57
    good and well. Also I think there's this
    underlying assumption that only if we
  • 2:57 - 3:02
    would get people excited and interested in
    programming, they would sort of acquire
  • 3:02 - 3:07
    the required skills by themselves and some
    process of trial and error or osmosis or
  • 3:07 - 3:11
    something like that. And I think the most
    prominent project that propagated that
  • 3:11 - 3:15
    notion – some of you may remember – was
    this One Laptop Per Child initiative a
  • 3:15 - 3:18
    couple of years ago. And you don't … I
    haven't seen many of those at this
  • 3:18 - 3:24
    conference. And the reason for that is
    that the educational concepts around One
  • 3:24 - 3:28
    Laptop Per Child were based on this idea
    of – I think – what's called
  • 3:28 - 3:32
    constructivism. This idea that only if you
    give children enough material and access
  • 3:32 - 3:36
    to whatever the Internet and teaching
    materials, then they will all figure it
  • 3:36 - 3:40
    all out themselves and they will figure
    out how to build programs by themselves.
  • 3:40 - 3:44
    And I think one of the underlying problems
    – I mean there were many problems with
  • 3:44 - 3:48
    OLPC. But one of the problems was
    certainly that just this approach to
  • 3:48 - 3:54
    didactics and pedagogy doesn't work
    particularly well. And you find variations
  • 3:54 - 3:58
    of that pretty much every year. There's an
    educational initiative built on this
  • 3:58 - 4:02
    notion of inspiring – you know – passion
    for programming. You know, last year you
  • 4:02 - 4:09
    would hear about a project called Bob
    which essentially is about programming a
  • 4:09 - 4:12
    little robot-like device, that has
    blinking lights and things like that. And
  • 4:12 - 4:17
    it's certainly very interesting and you
    program it by – I think you can see that
  • 4:17 - 4:23
    here – you program it by essentially
    downloading already … someone already
  • 4:23 - 4:26
    programmed some C++ code for you, and you
    take some line in the middle and change it
  • 4:26 - 4:30
    to change the blinking through frequency
    or something like that. And again all that
  • 4:30 - 4:34
    is good and well; and I don't want to
    denigrate that, but it's all good and well
  • 4:34 - 4:39
    for inspiring passion. But all of these
    projects have in common is that they are
  • 4:39 - 4:44
    not really about teaching the methodology
    of programming. And so this is, you know,
  • 4:44 - 4:47
    this is what this talk is about and it's
    probably going to be the most boring talk
  • 4:47 - 4:54
    you've ever heard. If you want to inspire
    passion for programming and for computers,
  • 4:54 - 4:57
    there's lots of projects right outside
    this door – specifically today on the
  • 4:57 - 5:02
    Junghackertag – that will tell you how to
    do that. The problem is that if you want
  • 5:02 - 5:06
    to transition from these projects to
    actually serious substantial programming
  • 5:06 - 5:10
    projects that your learners want to
    undertake by themselves … and if you look
  • 5:10 - 5:15
    closely enough, you will find that a lot
    of people get frustrated by that
  • 5:15 - 5:19
    experience of writing more complex
    programs. And even if they do not get
  • 5:19 - 5:25
    frustrated, their code often ends up
    looking like that on the right hand side.
  • 5:25 - 5:30
    And so of course this entire conference is
    in the spirit of tinkering and building
  • 5:30 - 5:34
    things by trial and error; and you see a
    lot of things that look like this. But,
  • 5:34 - 5:39
    you know, in the upcoming IOT apocalypse
    maybe we want to have a little bit
  • 5:39 - 5:44
    slightly more methodical approach. So the
    problem is really that most didactic
  • 5:44 - 5:49
    approaches to programming do not work very
    well. For the longest time I really didn't
  • 5:49 - 5:53
    have a good explanation as to why that was
    and why maybe the stuff that I was doing
  • 5:53 - 5:57
    or that I learned how to do over the years
    worked better. And so finally I found a
  • 5:57 - 6:03
    great book that confirms some of my
    biases, that I read just the day before
  • 6:03 - 6:08
    yesterday – as I was preparing this talk.
    And it has a couple of … It's written by a
  • 6:08 - 6:15
    cognitive scientist – Daniel Willingham –
    and he lists a couple of principles that
  • 6:15 - 6:19
    are active when students learn, right? And
    I think one of the things that's really
  • 6:19 - 6:24
    important is that we all have this
    idealistic notion that everybody loves to
  • 6:24 - 6:29
    learn, right? But in fact learning is
    quite a difficult activity and it's quite
  • 6:29 - 6:34
    straining. And – so even though people are
    curious about things and they love to look
  • 6:34 - 6:37
    at things and they like to have successful
    learning experiences – if that learning
  • 6:37 - 6:43
    experience means they have to think hard,
    then at least some people shun those same
  • 6:43 - 6:49
    experiences. Another problem is … so and
    that's of course a problem when you
  • 6:49 - 6:53
    transition from a primitive programming
    environment, like Scratch or Bob or
  • 6:53 - 6:57
    something, to more complicated things that
    you can easily get frustrated, and then
  • 6:57 - 7:03
    shun away from the learning experiences
    that are required to take the next step.
  • 7:03 - 7:05
    Another one that I found interesting is –
    so these are just all the cognitive
  • 7:05 - 7:10
    principles in that book – so it's kind of
    very textual and boring, but I liked it so
  • 7:10 - 7:15
    much. So it says: "Factual knowledge
    precedes skill." But if you think, so what
  • 7:15 - 7:20
    it means is really that you need to have …
    that if you want to learn a particular
  • 7:20 - 7:23
    skill, you need to associate that with
    factual knowledge. But if you think about
  • 7:23 - 7:27
    the factual knowledge that is associated
    with programming, then a lot of the
  • 7:27 - 7:31
    principles underlying our everyday
    programming skills are usually unnamed.
  • 7:31 - 7:35
    And they're not really put in specific
    words, and so they're not in the form of
  • 7:35 - 7:39
    factual knowledge. And which is why a lot
    of people have trouble with the skill
  • 7:39 - 7:45
    part. I love this bit which says: "Memory
    is the residue of thought." Which is that
  • 7:45 - 7:47
    we don't always remember the things that
    we should be remembering, but that we
  • 7:47 - 7:51
    remember things that we spend a lot of
    thought on. And that means in particular
  • 7:51 - 7:54
    for educational initiatives that are
    centered around robots – or something
  • 7:54 - 7:59
    that's really … that is supposed to take
    over the passion part of programming but
  • 7:59 - 8:03
    not really central to the activity of
    programming – people tend to think about
  • 8:03 - 8:06
    the robots: They tend to think about the
    motors and actuators and things like that;
  • 8:06 - 8:10
    and those are worthy skills in and of
    themselves, but they don't contribute much
  • 8:10 - 8:15
    to the actual skill of programming. I
    remember asking a proponent of such an
  • 8:15 - 8:19
    educational initiative a number of years
    back, you know what is it? What is the
  • 8:19 - 8:23
    skill that students take away from your
    robot class? And he said "well, after that
  • 8:23 - 8:26
    class where they spend all their free time
    for a semester or a year, they really know
  • 8:26 - 8:35
    what pi is. And I don't know for me that
    is not enough. So another thing is that …
  • 8:35 - 8:39
    maybe that doesn't go so much towards
    computer science or programming experience
  • 8:39 - 8:44
    but also to the way that we do math
    education: Is we understand new things in
  • 8:44 - 8:49
    the context of things we already know. In
    particular we find it easier to understand
  • 8:49 - 8:56
    concrete things. And I think both in math
    and computer science a lot of explanations
  • 8:56 - 9:00
    are in the form of explaining some
    abstract thing rather than showing how to
  • 9:00 - 9:04
    do a concrete thing. And so we'll get
    back. So this is going to be a major point
  • 9:04 - 9:10
    later on. Something that didn't really
    need saying in that book: "Proficiency
  • 9:10 - 9:13
    requires practice." If you want to get
    better at programming, you'll need to
  • 9:13 - 9:17
    practice it with the goal of getting
    better at it. So in the classroom or in a
  • 9:17 - 9:22
    teaching environment you really need to
    create situations that foster successful
  • 9:22 - 9:27
    practice, the successful solution of
    problems. So that, you know, this natural
  • 9:27 - 9:32
    curious part in the beginning. So student,
    so people generally derive a dopamine rush
  • 9:32 - 9:37
    from successfully solving problems. So we
    really need to put … we really need to put
  • 9:37 - 9:42
    our students in a situation where they can
    successfully solve problems – that are not
  • 9:42 - 9:45
    too hard and also not too easy, because if
    they're too easy, the dopamine rush will
  • 9:45 - 9:52
    not be big enough. Here's a trap I think
    that most people who teach programming
  • 9:52 - 9:54
    know about is that "cognition is
    fundamentally different early and late in
  • 9:54 - 9:58
    training". And if you're here, most people
    in this room are late in training. So
  • 9:58 - 10:02
    we've been in touch with computers for a
    long time, so our cognitive processes when
  • 10:02 - 10:06
    we think about programming are different
    than the cognitive processes of beginning
  • 10:06 - 10:10
    students. Sometimes that's also called the
    curse of knowledge. So just because we
  • 10:10 - 10:14
    find some piece of material inspiring or
    interesting – or some technique of
  • 10:14 - 10:18
    explaining something very persuasive –
    that does not mean that our students find
  • 10:18 - 10:23
    it similarly persuasive and find it
    similarly easy to follow along our
  • 10:23 - 10:28
    teaching. If you're teaching big
    classrooms I think there's being have been
  • 10:28 - 10:34
    a big push towards individualistic
    learning. And of course that's wonderful.
  • 10:34 - 10:38
    On the other hand our children tend to be
    quite alike in their style of learning.
  • 10:38 - 10:42
    And so I'm not going be talking about that
    much that very much today but there's
  • 10:42 - 10:46
    still great value in having a classroom
    with several students that are all being
  • 10:46 - 10:54
    taught the same thing. Not a subject today
    but I could also … that that also has been
  • 10:54 - 10:59
    confirmed by my experience. Generally,
    some people think that you know some
  • 10:59 - 11:02
    people are good at math and some people
    are bad at math. You know girls are always
  • 11:02 - 11:06
    bad at math for some reason and it turns
    out that this is … Well first of all it's
  • 11:06 - 11:11
    not true. And even if you feel you're bad
    at something then usually what we call
  • 11:11 - 11:15
    intelligence can be changed through
    sustained hard work. I think you know 10
  • 11:15 - 11:20
    or 20 years ago a lot of people believed
    in IQ that an innate ability to learn
  • 11:20 - 11:25
    things. But it turns out that that most of
    the effects of IQ on your ability do
  • 11:25 - 11:29
    things well are quite indirect and through
    the environment rather than through some
  • 11:29 - 11:35
    structure in your brain that you were born
    with. And so that's something that you
  • 11:35 - 11:40
    really learn when you do 30 years of
    teaching is really that your teaching can
  • 11:40 - 11:44
    improve over time. But in order to improve
    you really must get feedback and you must
  • 11:44 - 11:49
    practice it and get feedback the same way
    that the skill itself must be practiced.
  • 11:49 - 11:54
    And that sometimes gets you feedback that
    is surprising sometimes and also it's
  • 11:54 - 11:59
    often quite quite painful because
    sometimes you get the feedback that you're
  • 11:59 - 12:04
    teaching just did not work. So really, I
    want to aim a programming education at a
  • 12:04 - 12:09
    diverse audience and not just I mean if
    you look at the Robot class if you're
  • 12:09 - 12:13
    student population that ends up being in
    that robot class is really as diverse as
  • 12:13 - 12:17
    you like it as you'd like it to be. I
    think often that is not the case. So the
  • 12:17 - 12:20
    stuff that I'm going to talk about and
    then I'm going to talk about has been
  • 12:20 - 12:24
    applied not always by me but to children,
    to high school students, to university
  • 12:24 - 12:28
    students, professional developers and
    works quite well. And what it is based on
  • 12:28 - 12:34
    is a set of systematic methods and I'll
    try to show you in great and painstaking
  • 12:34 - 12:40
    detail what that means. And so here are
    some references that you can look at. In
  • 12:40 - 12:44
    particular we built on the work of the PLT
    group in the U .S. led by Matthias
  • 12:44 - 12:48
    Felleisen, who have a great book out now.
    I'll give you a reference to that later.
  • 12:48 - 12:53
    There is a there's a significant project
    for teaching high school students in the
  • 12:53 - 12:56
    U.S. and there's also a project that I'm
    involved with what's called which is
  • 12:56 - 13:01
    called "Dein Programm", which tries to be
    sort of the little German sister of that
  • 13:01 - 13:09
    stuff. So one aspect that's important to
    this method of teaching is that all the
  • 13:09 - 13:14
    tools that we use are geared towards
    learners in particular that means that
  • 13:14 - 13:17
    there is a specific programming
    environment that was made specifically for
  • 13:17 - 13:23
    learners rather than your Emacs or VI or
    whatever your favorite thing is that you
  • 13:23 - 13:27
    want to, that you want to inflict on your
    learners. I don't think you should. I'm an
  • 13:27 - 13:34
    Emacs person myself. So also what it means
    is that we have … that we use specific
  • 13:34 - 13:38
    programming languages that are derived
    from real programming languages but that
  • 13:38 - 13:44
    have been modified to be especially
    suitable for learners. And also then we
  • 13:44 - 13:50
    have something called the design recipes
    which are a set of methods for systematic
  • 13:50 - 13:55
    program construction that try to provide
    this factual basis for the methodology of
  • 13:55 - 13:59
    programming. And so there's programming
    environment … All of this stuff by the way
  • 13:59 - 14:05
    can be downloaded for free. And so there's
    a great system called racket developed by
  • 14:05 - 14:09
    the PLT group but there's a tiny corner in
    there that I'm going to refer to today
  • 14:09 - 14:13
    which is great for many things but it was
    originally designed and still is great for
  • 14:13 - 14:23
    teaching so. So let me try to switch to
    that. I hope that works out. This moment
  • 14:23 - 14:31
    always scares me. So here is the system
    called Doctor racket and you can see it
  • 14:31 - 14:35
    has not very many buttons it does not look
    like Eclipse or Visual Studio or something
  • 14:35 - 14:39
    like that does not look like a
    professional programming environment. And
  • 14:39 - 14:44
    the way this works is I'm going to try to
    show you how it works is in the upper part
  • 14:44 - 14:47
    of that window there's just the program
    that's a text editor with a couple of
  • 14:47 - 14:52
    special features - not very many. And down
    here is the REPL, which you can use to
  • 14:52 - 14:56
    interact with the program that you've
    written. I'm not gonna use that very much.
  • 14:56 - 15:01
    But what you can do in the REPL - in the
    beginning at least - is you can just type
  • 15:01 - 15:05
    something and it will give you … it will
    then immediately tell you the result of
  • 15:05 - 15:11
    the evaluation of what you typed in. And
    now you have to remember … This is gonna
  • 15:11 - 15:16
    be alien and strange to you. But the way
    this works is these languages are based on
  • 15:16 - 15:20
    Lisp. So they use round parentheses a lot
    and specifically when … always when you
  • 15:20 - 15:23
    want to put something together they have
    around parentheses and they have the
  • 15:23 - 15:27
    operator in front and - especially if
    you've been programming for a long time -
  • 15:27 - 15:30
    you think "Oh no, this is … Never gonna
    get used to that!" but I can promise you,
  • 15:30 - 15:36
    your children will have a very easy time
    dealing with this. So you could go and say
  • 15:36 - 15:40
    you know you could just type a number and
    it will give you the result. You would
  • 15:40 - 15:48
    type a string, you know, "Mike". It will
    give you the result. It … you could go and
  • 15:48 - 15:53
    you could you know, you could combine
    numbers, right, by adding them together.
  • 15:53 - 15:57
    You could let's do away with that. Looks
    like this. So that's what it what it looks
  • 15:57 - 16:01
    like a compound expression has always
    parens around it and the operator in
  • 16:01 - 16:05
    front. So you don't really say you know
    this number plus that number you say the
  • 16:05 - 16:12
    sum of those two numbers. OK. And so gives
    me the result of that. What's kind of fun
  • 16:12 - 16:16
    if you're a C programmer or Java
    programmer this is kind of fun, but
  • 16:16 - 16:24
    children love this for some reason I know.
    So what you can also do is the same way
  • 16:24 - 16:28
    that you're used to having numbers and
    strings and whatever and booleans be
  • 16:28 - 16:33
    values. Pictures are also values so that
    sometimes helps when you're trying to drum
  • 16:33 - 16:37
    up that little piece of motivation that
    you need. So you could do like a rectangle
  • 16:37 - 16:45
    that is solid blue and that's a value. And
    whatever whenever there is a value you can
  • 16:45 - 16:51
    write a program that binds that value to a
    name by writing "define". So you could do
  • 16:51 - 16:58
    something really exciting like this. You
    would define "pi" for something. We could
  • 16:58 - 17:04
    run that program and then we could put top
    pi here but we could also do you know "r"
  • 17:04 - 17:14
    that rectangle and whatever 50 solid red
    and we can run that program. And here's
  • 17:14 - 17:20
    that rectangle. What's maybe more
    interesting is that we can maybe do
  • 17:20 - 17:26
    another rectangle that's solid blue and
    you can also see here's the same principle
  • 17:26 - 17:30
    at work right. Parentheses around the
    define so "define" says it's a definition
  • 17:30 - 17:34
    and the rectangle is just a call to a
    function that comes with Dr. Racket and
  • 17:34 - 17:40
    it's also in front. And so I could do
    that. Now I have "r" I have "f2" and I
  • 17:40 - 17:44
    could also do things, things like you know
    there's for example a function that takes
  • 17:44 - 17:50
    two pictures and puts them beside each
    other so there's a little jumping ahead a
  • 17:50 - 17:53
    little bit there's a little algebra of
    pictures in here that you can use to
  • 17:53 - 17:56
    program video games for example later in
    the class if that's something that you
  • 17:56 - 18:04
    want to do. So this is not entirely
    without motivational examples. So there's
  • 18:04 - 18:14
    that. Yeah. Let's see how far we can go
    from there. OK. So but getting away from
  • 18:14 - 18:21
    those motivational examples. In German we
    are very big on traffic rules. Right.
  • 18:21 - 18:25
    Straßenverkehrsordnung. So there are many
    rules, right, and we'll try to model that.
  • 18:25 - 18:29
    This is going to make this the most boring
    talk you've ever heard. So we're gonna
  • 18:29 - 18:34
    categorise German traffic violations. So
    in particular there's two kinds of traffic
  • 18:34 - 18:39
    violations. There's red light violations
    where it's important where they happen and
  • 18:39 - 18:43
    it's also important what the duration is.
    How long after the light has turned red
  • 18:43 - 18:48
    passes before you actually cross the
    intersection or the red light. And then
  • 18:48 - 18:52
    there's a speeding violation where you
    also have a place and you just have how
  • 18:52 - 18:56
    many kilometres per hour did you go over
    the limit. And we want to write functions
  • 18:56 - 19:01
    and I'll tell you how to do that for
    yielding the place of a violation and
  • 19:01 - 19:07
    classifying a violation as serious or not.
    And for that purpose we're going to do …
  • 19:07 - 19:13
    use something called the design recipe or
    rather as there's we're going to use
  • 19:13 - 19:16
    several design design recipes and first of
    all there's an overall design recipes,
  • 19:16 - 19:21
    which says how you write a function. And
    please don't fall asleep. There's one,
  • 19:21 - 19:25
    two, three, four, five, six, eight, eight
    steps to this. And we always ask our
  • 19:25 - 19:30
    students to always go through those eight
    steps and you think: this is off. I mean I
  • 19:30 - 19:34
    hope you do right. You feel this is this
    already looks like the most boringest, you
  • 19:34 - 19:38
    know, exposition to programming ever. This
    is like the German bureaucracy approach to
  • 19:38 - 19:46
    teaching how to program. On the other
    hand, so, but, you know, it works. That is
  • 19:46 - 19:51
    the point. Specifically each of those
    steps is something that is small enough so
  • 19:51 - 19:54
    that students can usually successfully do
    it. And if you can reward it with credit
  • 19:54 - 19:59
    or candy or whatever then you know
    students will be motivated to get to the
  • 19:59 - 20:04
    next step. You know if you've ever taught
    unsuccessfully and probably most of you
  • 20:04 - 20:08
    have always taught successfully but what
    always happened to me is then when my
  • 20:08 - 20:14
    teaching would be unsuccessful my students
    would be staring at a blank screen. Right.
  • 20:14 - 20:17
    And that would give them this problem and
    I felt this problem was really solvable
  • 20:17 - 20:23
    and they would give up before typing the
    first key. Right. They wouldn't know where
  • 20:23 - 20:27
    to begin because there's usually most
    approaches to teaching how to program are
  • 20:27 - 20:31
    example based. They give you some example.
    You know, here's that program solves that
  • 20:31 - 20:34
    problem. How here's a different problem,
    now solve that. And you already saw how
  • 20:34 - 20:40
    that's done. And that process usually or
    often does not work. And so this fixed
  • 20:40 - 20:44
    sequence of steps gets students over that
    hump and I'm gonna try to explain that
  • 20:44 - 20:47
    really in painstaking detail because the
    books don't really do justice to a how
  • 20:47 - 20:53
    bureaucratic and painstaking it is. So you
    all have the benefit of that. So there's
  • 20:53 - 20:56
    always these eight steps and then there's
    more instructions that come with each of
  • 20:56 - 21:02
    those steps. Right. But these instructions
    are eminently learnable and that's the
  • 21:02 - 21:08
    important aspect here. So in particular.
    So I'm gonna, sort of, jump in right
  • 21:08 - 21:20
    ahead. Oops, oops. Ah. You see something
    that I don't see. There we go. So if you
  • 21:20 - 21:27
    look at this problem statement. So let me
    go back one more. So it says the first
  • 21:27 - 21:30
    thing that you do is well you draw a short
    description of a function we already have
  • 21:30 - 21:34
    two short descriptions of the functions
    you know find the place of a traffic
  • 21:34 - 21:37
    violation and find out if it's serious or
    not. And then it says please conduct a
  • 21:37 - 21:43
    data analysis and data analysis means that
    you look at the entities in your problem
  • 21:43 - 21:48
    and and analyze them. And here it says
    while this is all about traffic
  • 21:48 - 21:53
    violations. And it says something of the
    sort. That there's for example a red light
  • 21:53 - 21:57
    violation. And it says that red light
    violation has place and duration and that
  • 21:57 - 22:02
    duration is in seconds. So one thing that
    you can do is you can look at the wording
  • 22:02 - 22:06
    of how that data is described and if you
    discover wording that says you know this
  • 22:06 - 22:12
    thing consists of these pieces. Right. Or
    this thing has several different
  • 22:12 - 22:18
    properties. This is a phenomenon that we
    call compound data and that has a special
  • 22:18 - 22:28
    design recipe that PowerPoint somehow
    threw away. See OK it comes up again. So
  • 22:28 - 22:32
    it says well you recognize compound data
    by a description of your data that uses
  • 22:32 - 22:37
    words like "consists of" or "has". And
    then you write a data definition of that
  • 22:37 - 22:42
    form and I will show you how that works.
    Then, something really trivial comes you
  • 22:42 - 22:44
    count the ingredients and you write a
    what's called a record definition that's
  • 22:44 - 22:50
    actual code and then you ensure that the
    counts match and these are instructions in
  • 22:50 - 22:57
    the textbook. Right. And students learn to
    memorize those instructions and you all
  • 22:57 - 23:04
    going asleep. You know you're all falling
    asleep. Sorry about that. So let's see
  • 23:04 - 23:10
    where is the right window. Here's the
    right window. So that's what we were
  • 23:10 - 23:16
    doing. Right. I'm going to leave that here
    for your entertainment. It says well a red
  • 23:16 - 23:23
    light violation… So excited, I need to
    talk. And we said it has this formulation
  • 23:23 - 23:27
    that says "has". We're just going to write
    it down in a slightly more systematic way.
  • 23:27 - 23:34
    So, it has a place and it has a duration
    in seconds. Right. And that's just a piece
  • 23:34 - 23:40
    of natural language and those semicolons,
    they make this a comment. OK. So we didn't
  • 23:40 - 23:44
    do much except writing each component of
    our compound data in a separate line. And
  • 23:44 - 23:47
    then it said - I can't really display it
    at the same time - then it said, write a
  • 23:47 - 23:53
    record definition and a record definition
    has this form. It is, it really it looks a
  • 23:53 - 24:01
    little tedious. But it's actually quite
    valuable. So it says we're talking about
  • 24:01 - 24:06
    red light violations so we give our thing
    a name. So that's called "red-light-
  • 24:06 - 24:13
    violation" then we will need to create
    "red-light-violation" objects. So we will
  • 24:13 - 24:16
    need a constructor so I'm going to write
    down the name of that constructor.
  • 24:16 - 24:20
    Eventually we will need to distinguish red
    light violations from other things. So I'm
  • 24:20 - 24:24
    going to write something it's a predicate
    that we'll use a little later and then we
  • 24:24 - 24:29
    have two parts. And I can't emphasize
    enough how important it is that you sort
  • 24:29 - 24:32
    of remember: two. Right? It has two parts,
    because it says that there's a place and a
  • 24:32 - 24:38
    duration in seconds and we write the names
    of things that will extract those pieces.
  • 24:38 - 24:43
    So we go here it says "red-light-
    violation-place" and "red-light-violation-
  • 24:43 - 24:50
    duration". Or we could, let's call it
    seconds, so we always know what that is.
  • 24:50 - 24:59
    And now what that does is when I run it is
    well it doesn't do anything. But what we
  • 24:59 - 25:06
    can do is. We can now create objects that
    represent red light violations. And so
  • 25:06 - 25:11
    what we could do is… Well let me first
    show you how it's done. We do "make-red-
  • 25:11 - 25:16
    light-violation". You know there's one in
    Borg. Somebody who, you know, had a red
  • 25:16 - 25:20
    light violation for four seconds in Borg.
    Right. And then it will display a record
  • 25:20 - 25:29
    value that shows what the parts are that
    we had. And so I can copy this up here and
  • 25:29 - 25:37
    call it and make an example out of that.
    And so like this. So now we have "rv1"
  • 25:37 - 25:44
    here. So this is what's called a
    constructor and this constructor when we
  • 25:44 - 25:48
    call it creates this object and this
    object really creates data that is
  • 25:48 - 25:53
    associated with information. So that's an
    important aspect to explain. And so
  • 25:53 - 25:58
    usually we ask students and I can't I'm
    not writing this down to explain it to you
  • 25:58 - 26:04
    I'm writing it down to show to you what to
    expect from students. And so you go "Oh",
  • 26:04 - 26:21
    make them do it. So this is a red light
    violation in Borg, 4 seconds. So it seems
  • 26:21 - 26:29
    really trivial to you but it's important
    to really … to link the program to the
  • 26:29 - 26:36
    problem domain that we're in, right. So we
    have a minor red light violation here.
  • 26:42 - 26:51
    Am I spelling this right? Anyway, so here
    we go. And one way to talk about this new
  • 26:51 - 26:54
    function that we created "make-red-light-
    violation" is writing down something that
  • 26:54 - 27:00
    we call a signature. It looks like, sort
    of like a type signature but isn't quite.
  • 27:00 - 27:04
    That's something that we did specifically
    for teaching. So you do "make-red-light-
  • 27:04 - 27:12
    violation" and remember in math you would
    sometimes write f Doppelpunkt, f colon to
  • 27:12 - 27:16
    denote a type. And here we just put the
    colon in front. So it says "make-red-
  • 27:16 - 27:21
    light-violation". Well it takes a string,
    that says what the places is, it takes
  • 27:21 - 27:25
    some rational number, that says how long
    it went, how long the red light violation
  • 27:25 - 27:36
    was over the limit, and it creates a red
    light violation object. So that's not
  • 27:36 - 27:43
    gonna do much, unless, well let me let me
    show you something. If I wrote something
  • 27:43 - 27:59
    else here I wrote a number here.
    Something… Where'd it go? So it's, so it
  • 27:59 - 28:02
    says it gives an error message here. And
    it's I think it's due to this full screen
  • 28:02 - 28:18
    mode for some reason. Let me see if we can
    do this again. No, not quite. OK, now we
  • 28:18 - 28:23
    know what it is so. So. Yeah it was. So,
    when you. Unfortunately it is in German so
  • 28:23 - 28:26
    I hope some of you read German I'll try to
    translate it says well this program still
  • 28:26 - 28:31
    has to be tested but it says there was a…
    It says here "Signaturverletzung", which
  • 28:31 - 28:38
    means signature violation. And it says I
    got five in this line here. And really, so
  • 28:38 - 28:44
    this is the five. Oops, right here in this
    line. And it violated the signature here.
  • 28:44 - 28:47
    So it gives you… So the system. That's one
    aspect of what makes the system
  • 28:47 - 28:53
    specifically designed for learners is that
    it gives you very specific feedback as you
  • 28:53 - 29:03
    run the program. OK. So let's do away with
    this. Let's get this down here. So now one
  • 29:03 - 29:06
    of the challenges or one of the problems
    in the problem statement was to write a
  • 29:06 - 29:12
    function that determines whether a red
    light violation is serious or not. And so
  • 29:12 - 29:16
    when we do that, it said, well, you put a
    short description in front. And so here's
  • 29:16 - 29:20
    a short description. And there's lots of
    religious wars about how many comments you
  • 29:20 - 29:24
    should put in a program but to our
    learners we say put one line not more not
  • 29:24 - 29:30
    less in front of every function. And
    that's usually about the right level. So
  • 29:30 - 29:38
    is a red light violation serious? So the
    next thing is. Well if you remember that
  • 29:38 - 29:41
    slide it says, well, if you're writing a
    function, if you're implementing a piece
  • 29:41 - 29:43
    of functionality, that always ends up
    being a function in functional
  • 29:43 - 29:47
    programming, you write a signature for
    that function that talks about what goes
  • 29:47 - 29:53
    in and out of that function. So in this
    case. Well we have to make up a name for
  • 29:53 - 30:02
    that. So it practically writes itself here
    and so we just put so in this language you
  • 30:02 - 30:05
    can put a question mark in the middle of a
    name and you can also put hyphens in the
  • 30:05 - 30:11
    middle of a name. And what we want is we
    want a red light violation to go in and we
  • 30:11 - 30:16
    want a boolean to come out that says
    whether that violation was serious or not.
  • 30:16 - 30:20
    So those are already steps in that design
    recipe that you saw. And so if you're in a
  • 30:20 - 30:24
    classroom situation or whatever you can
    give credit for each immediate step and
  • 30:24 - 30:29
    you should, because those are already
    those are all small successes in your
  • 30:29 - 30:33
    programming endeavor. So the next thing
    that you should do is, you should write
  • 30:33 - 30:39
    examples or tests. Those are almost the
    same thing here. And so, fortunately we
  • 30:39 - 30:43
    already have examples of red light
    violations. So we just have to write down
  • 30:43 - 30:49
    how we expect our function to behave with
    respect to those examples. So there's
  • 30:49 - 30:54
    something called "check-expect" and I hope
    you recognize that principle that we're,
  • 30:54 - 31:00
    that things are always named in the front.
    So we could say "red-light-violation-
  • 31:00 - 31:04
    serious?". With children you might want to
    pick shorter names if they can't type that
  • 31:04 - 31:12
    fast yet, but with grown ups this works.
    So the first one is four seconds over, so
  • 31:12 - 31:18
    that's pretty serious. So we expect that
    to be true and that "#t" means true. And
  • 31:18 - 31:30
    so. And you. And the other one is half a
    second over and that's not so serious
  • 31:30 - 31:35
    under German law. That's fine. OK. So the
    next step. So now we've written. So let me
  • 31:35 - 31:40
    let me label those things right. This is
    the short description. This is the
  • 31:40 - 31:47
    signature. These are the tests. And now
    you write something called the skeleton
  • 31:47 - 31:51
    and the skeleton is just you start writing
    the function but you already have some
  • 31:51 - 31:54
    information about that function you know
    the name of that function and you know how
  • 31:54 - 32:08
    many things come in and out. So you write
    - oops typo here - so and, well, this is a
  • 32:08 - 32:12
    functional language so somebody always has
    to write lambda somewhere. So when we make
  • 32:12 - 32:15
    a function in these languages we always
    write lambda. So we want to make a
  • 32:15 - 32:19
    function that accepts one thing and that
    is a red light violation a red light and
  • 32:19 - 32:28
    we'll just call it "rlv" and we'll just
    put three dots here. So the three dots I
  • 32:28 - 32:31
    don't mean to say we're gonna fill in the
    rest later. It means in class when I do
  • 32:31 - 32:36
    this I actually type three dots and in
    class especially at the beginning we
  • 32:36 - 32:40
    actually ask our students to type the
    three dots because this is the skeleton.
  • 32:40 - 32:47
    This already gives you credit and it's,
    you know since this is so easy to do, it
  • 32:47 - 32:52
    really means that there's, you're not
    staring at a white piece of paper and
  • 32:52 - 32:57
    maybe you feel encouraged to do that next
    step. Now the next step says you have to
  • 32:57 - 33:01
    fill in what's called a template. And
    those are elements of the function that
  • 33:01 - 33:07
    you're writing that derive from the data
    that goes in and sometimes from the data
  • 33:07 - 33:11
    that goes out. In this case the data that
    goes in is one of those red light
  • 33:11 - 33:15
    violation objects and that red light
    violation object if you may remember is a
  • 33:15 - 33:19
    compound object it has two pieces. And
    whenever you write a function that accepts
  • 33:19 - 33:24
    compound data with two pieces you probably
    need to look at those pieces. So, what you
  • 33:24 - 33:31
    do is, you write you have to write
    something that will tell you what those
  • 33:31 - 33:38
    pieces are and remember. So I haven't
    actually told you how that works. But
  • 33:38 - 33:43
    remember here was the record definition,
    up here, and it told us and we have a
  • 33:43 - 33:47
    signature there that tells us how to
    construct a red light violation object.
  • 33:47 - 33:51
    And so what we also need is we need a way
    to get the components out of a red light
  • 33:51 - 33:54
    violation object. So we need what's called
    selectors or assessors. And those are the
  • 33:54 - 33:59
    things in parentheses here and here and
    you can also describe them with
  • 33:59 - 34:07
    signatures. And strangely enough so and
    here a red light violation thing goes in
  • 34:07 - 34:21
    and a string comes out. And in this case,
    a red light violation goes in and a - what
  • 34:21 - 34:24
    do we say - a rational comes out. So those
    are of course… Those signature
  • 34:24 - 34:27
    declarations are redundant. You don't have
    to put them in there. Redundant with a
  • 34:27 - 34:30
    constructor declaration and you're
    going asleep, you're going asleep
  • 34:30 - 34:31
    anymore... Even
  • 34:31 - 34:35
    more probably than you were. But I had an
    epiphany in class where I would only write
  • 34:35 - 34:40
    the constructor signature and the students
    would ask me to also write the excessive
  • 34:40 - 34:46
    signatures. And so they made me even more
    bureaucratic than I was already by then I
  • 34:46 - 34:51
    already was by nature. So now here what we
    do is we want to get access to the
  • 34:51 - 34:59
    different parts. So we write "red-light-
    violation-place" of "rlv". So that's one
  • 34:59 - 35:06
    piece. "-violation-seconds" of "rlv".
    That's the second part. And those are
  • 35:06 - 35:09
    building blocks. So really if you're
    really strict about it you might have
  • 35:09 - 35:17
    people type three dots in here also. So
    these just say, these are building blocks
  • 35:17 - 35:21
    for your function. And so you think about
    how those parts contribute to the answer
  • 35:21 - 35:25
    to your questions. The question was is the
    red light cycle violation serious or not.
  • 35:25 - 35:29
    Then you can think about. Well is the
    place relevant whether it was serious or
  • 35:29 - 35:33
    not. And in Germany I think it's not. But
    it is relevant how many seconds you went
  • 35:33 - 35:39
    over. So, you then have– then you go
    through this conscious act of: you've
  • 35:39 - 35:44
    written it down but now you delete it
    again because you've done a little bit of
  • 35:44 - 35:51
    thinking. And you go and, well, then you
    look up– I look this up on the Internet.
  • 35:51 - 35:56
    If it's over one second then – or if it's
    one second or over – then it's serious,
  • 35:56 - 36:03
    and then you delete all the ellipses and
    make sure all the parentheses close and
  • 36:03 - 36:10
    then you run the program. And here's still
    the signature violation that we need to
  • 36:10 - 36:21
    fix. So it says here again there's a
    little German sentence because these
  • 36:21 - 36:25
    languages were designed for Germans and it
    says: both tests were successful, because
  • 36:25 - 36:31
    we wrote two test cases here. OK. So this
    bureaucratic approach just goes on and on.
  • 36:31 - 36:38
    So I'm just going to go through the second
    iteration more quickly. So it said you
  • 36:38 - 36:45
    know what did it say. It said, it said
    this. We also have a speeding violation.
  • 36:45 - 36:51
    So let's go through the motions of that: a
    speeding violation has– again, it also has
  • 36:51 - 36:59
    a place and it has, you know, how many
    kilometers per hour over. And we write a
  • 36:59 - 37:01
    record definition
  • 37:22 - 37:26
    something like this, and we could do,
    you know, two speeding
  • 37:26 - 37:32
    vio- so now we have a data definition that
    says: oh we've got two components, we've
  • 37:32 - 37:37
    got a record definition that needs to
    match that. You all think this is trivial
  • 37:37 - 37:41
    but with compound data our students often
    have trouble. So it serves you well to
  • 37:41 - 37:45
    remind them that there's two pieces, and
    those two pieces need to be selectors in
  • 37:45 - 37:52
    the record definition. So we have speeding
    violation one, speeding violation on Main
  • 37:52 - 38:00
    Street. You know what, 20 kilometers over,
    and we have another one, you know low
  • 38:00 - 38:13
    street or whatever, that is 25 kilometers
    over. So that is two examples right. And
  • 38:13 - 38:24
    we have one on low street, 25 kilometers
    per hour over limit. So once again the
  • 38:24 - 38:31
    speeding violation constructor has a
    little signature that says well a natural
  • 38:31 - 38:40
    number goes in, speeding violation object
    comes out. And so we go through those same
  • 38:40 - 38:43
    notions. I need two things in order to
    demonstrate one more thing. So then again
  • 38:43 - 38:59
    the question was: When is a speeding
    violation serious? And of course a
  • 38:59 - 39:08
    speeding violation goes in and a boolean
    comes out. And so we will write two tests.
  • 39:08 - 39:12
    So speeding violation in Germany is
    serious when it's 21 kilometres an hour
  • 39:12 - 39:15
    over the limit, or over that. Right. And
    it gets progressively more serious after
  • 39:15 - 39:22
    that. So. So the first one is not too
    serious. We'll not get you any points in
  • 39:22 - 39:38
    Flensburg. But the second one is. And once
    again we go right, speeding violation
  • 39:38 - 39:50
    serious, we write the skeleton. So then we
    write the skeleton, then we fill in the
  • 39:50 - 39:57
    gaps and says we really should be writing
    calls to the accessors. So we have the
  • 39:57 - 40:04
    place of the speeding violation and we
    have the kilometers over of the speeding
  • 40:04 - 40:10
    violations. And then we think a little bit
    and then we realize: oh the place does not
  • 40:10 - 40:15
    matter. So I'm skipping. Of course this
    all goes on usually over a longer period
  • 40:15 - 40:20
    of time that you're teaching. I'm going
    I'm going pretty fast here. So we do away
  • 40:20 - 40:28
    with that and we go well this really if
    this is over 21 then that's bad. Okay. So
  • 40:28 - 40:38
    let's see if that works. It says km per
    hour over– So then it says all four tests
  • 40:38 - 40:44
    are passed. So that's good. So you know
    there is primitive data, there's compound
  • 40:44 - 40:48
    data. You may have noticed that on the
    slide it said: a traffic violation is
  • 40:48 - 40:53
    either a red light violation or a speeding
    violation. So that's not compound data.
  • 40:53 - 40:59
    When you see this formulation in your
    language that says: it's this or that or
  • 40:59 - 41:02
    that or that, or maybe it is one of the
    following. Then you're not looking at
  • 41:02 - 41:08
    compound data, you're looking at a
    phenomenon called "mixed data". So you've
  • 41:08 - 41:15
    seen this, you've seen this, you've seen
    this mixed data. So you recognize it by
  • 41:15 - 41:19
    either the words "or" or "one of" and you
    write a data definition that really has
  • 41:19 - 41:23
    that form, you count the alternatives just
    like you do with compound data. You write
  • 41:23 - 41:26
    a signature definition. I'll show you how
    to do that. And you ensure that the counts
  • 41:26 - 41:33
    match. And so the way that you do that is
    this. We said data definition, so we said:
  • 41:33 - 41:43
    a traffic violation is one of the
    following. It's either a red light
  • 41:43 - 41:55
    violation or it is a speeding violation.
    And just as with the compound data this
  • 41:55 - 41:58
    little data definition has some code that
    goes with it. So we'll just call this
  • 41:58 - 42:04
    thing a traffic violation and we just use
    define to say what that is and define
  • 42:04 - 42:11
    traffic violation, is it just a signature
    that says it's mixed, it's mixed data from
  • 42:11 - 42:20
    red light violation and speeding
    violation. So here you go. So now we can
  • 42:20 - 42:24
    use that in signatures. You remember the
    problem statement didn't say: find out
  • 42:24 - 42:28
    whether a red light violation was serious
    or a speeding violation was serious, it
  • 42:28 - 42:35
    said: find out whether a traffic violation
    is serious. So you know it is a traffic
  • 42:35 - 42:41
    violation, but so far we only have
    functions, one works on red light
  • 42:41 - 42:44
    violations, the other one works on
    speeding violations, but they don't work
  • 42:44 - 42:54
    on that mixed. So we'll try to do that now
    and instead of writing red light violation
  • 42:54 - 43:01
    we'll just write traffic violation to
    boolean. So we could now write tests that
  • 43:01 - 43:05
    match those that are there but I'll spare
    you that. But in class we absolutely would
  • 43:05 - 43:16
    need to do that. And now what we do is,
    when we have a traffic violation– Remember
  • 43:16 - 43:21
    how I said if you have compound data, you
    put calls to the accessors in the body,
  • 43:21 - 43:25
    and then you go on from there. But now
    we're looking at mixed data in the input.
  • 43:25 - 43:30
    So mixed data has a different template and
    that template says: well if you're looking
  • 43:30 - 43:33
    at mixed data, maybe this or that or that,
    you should probably find out what that is
  • 43:33 - 43:40
    before you do anything else. And for doing
    that we use a conditional we use something
  • 43:40 - 43:45
    like this– So what we need to do is we
    need to distinguish red light violations
  • 43:45 - 43:48
    from speeding violations, so we need some
    function that will tell us which one it
  • 43:48 - 43:55
    is. And this is the last bit up here in
    the record definition. You remember that
  • 43:55 - 43:58
    we said red violation here, red light
    violation here. This is the name of the
  • 43:58 - 44:04
    constructor, so it is the constructor.
    These are the accessors. And this is
  • 44:04 - 44:08
    what's called the predicate, and the
    predicate tells us whether a thing is a
  • 44:08 - 44:14
    red light violation or not. So in this
    case the predicate says: red light
  • 44:14 - 44:20
    violation question mark, or "p" is what
    the programmers in these languages say.
  • 44:20 - 44:26
    And it takes anything and it tells us
    whether it is a red light violation object
  • 44:26 - 44:34
    or not. I'm just gonna copy that down so
    that we remember. We're almost done. So of
  • 44:34 - 44:37
    course the same thing goes for speeding
    violation. So we need a conditional that
  • 44:37 - 44:41
    has as many branches as we have
    alternatives in the data definition. And
  • 44:41 - 44:45
    again you think this is super trivial and
    childish, but it works very well for
  • 44:45 - 44:51
    making successful programmers. So we need
    two branches, and the way that works is
  • 44:51 - 44:59
    this. So you write this out with ellipses,
    and then you need to come up with tests
  • 44:59 - 45:03
    for the two branches in this case the
    tests are: is something a red light
  • 45:03 - 45:11
    violation or is it a speeding violation.
    So we have this, question mark tv, and we
  • 45:11 - 45:19
    have this which says, speeding violation
    tv. And now here we just need to put in
  • 45:19 - 45:22
    the answers, and the great thing is we
    already have the answers we already have
  • 45:22 - 45:33
    two functions that tell us whether a red
    light violation is serious and so we can
  • 45:33 - 45:42
    just call that here and we can do this
    here so and then we're done. So I think
  • 45:42 - 45:47
    that's all we can do in this hour that we
    have today. So I hope you see two things.
  • 45:47 - 45:57
    First of all this is super boring and
    super bureaucratic. But maybe you can see
  • 45:57 - 46:03
    that every single step that we have here
    has is a principle that has a specific
  • 46:03 - 46:06
    name and that you can explain in very
    specific concrete terms that are not
  • 46:06 - 46:10
    abstract. And that means it can really
    explain every step that's needed to solve
  • 46:10 - 46:16
    this problem. And I can't tell you what a
    game changer to that is for teaching. If
  • 46:16 - 46:20
    you really ask yourself if, you know, when
    you when you present an example to your
  • 46:20 - 46:24
    students whether you can really explain
    every single step and explain to the
  • 46:24 - 46:27
    students here's what you should have
    thought, you know, here's how you should
  • 46:27 - 46:33
    have picked what to do next. That usually
    ends up badly. So so one of the principles
  • 46:33 - 46:39
    behind this style of teaching is really to
    be absolutely sure every single step that
  • 46:39 - 46:43
    you expect your students to make when they
    solve a problem has a name and has been
  • 46:43 - 46:47
    explicitly taught in your class. So every
    technique has a name. You noticed me
  • 46:47 - 46:52
    saying compound data and mixed data and
    design recipe and template and skeleton.
  • 46:52 - 46:57
    And so this is the factual knowledge that
    we use that precedes the skill that we
  • 46:57 - 47:04
    want to then induce. If you're teaching a
    class that has rewards you reward every
  • 47:04 - 47:10
    single step. You really insist on form. I
    also can't stress this enough so on our
  • 47:10 - 47:14
    home page you find a paper that says form
    over function. We don't accept any program
  • 47:14 - 47:19
    that is correct. We just accept the ones
    that match the form that you've seen. We
  • 47:19 - 47:23
    also measure success. You know you really
    need to look at how well your teaching
  • 47:23 - 47:26
    style is doing and you improve it
    continuously. So those are the important
  • 47:26 - 47:32
    principles. You might think that this
    stifles creativity. And I really don't
  • 47:32 - 47:35
    think that's true. And I think that is
    based on a misguided notion of creativity.
  • 47:35 - 47:40
    So if you talk it successfully creative
    artists they really also rely on a set of
  • 47:40 - 47:45
    named techniques that they use to tackle a
    creative problem. And so somebody always
  • 47:45 - 47:49
    says Mozart you know Mozart never had to
    learn or practice before he got to be a
  • 47:49 - 47:54
    great composer but Mozart started it so
    early in childhood that he had his 10000
  • 47:54 - 48:01
    hours of practice in there to be before
    most people even start. So this works for.
  • 48:01 - 48:03
    So this has been proven to work this
    approach for children. I think I would
  • 48:03 - 48:08
    start about 11 years, beginning
    programmers. It's worked for programmers
  • 48:08 - 48:12
    that had learned some other via some other
    approach you know bad habits and
  • 48:12 - 48:16
    professional developers. There's two
    websites that you can go on to get more
  • 48:16 - 48:21
    information. One is our American sister
    project called programmed by design that
  • 48:21 - 48:25
    has lots of material, links and
    publications. The DrRacket software that I
  • 48:25 - 48:29
    showed you. And there's also a book in
    English how to design programs. And it
  • 48:29 - 48:33
    doesn't say that here but that book is
    available for free online but there's also
  • 48:33 - 48:37
    a print version. And similarly if you're
    looking for German language material
  • 48:37 - 48:41
    there's "dein programm DOT de" which also
    has links and publication, links to the
  • 48:41 - 48:46
    same software. And the draft version of
    that book is there too. And hopefully
  • 48:46 - 48:50
    we'll have a print version of that also
    next year. And that's all I have for you
  • 48:50 - 48:52
    today. Thank you very much.
  • 48:52 - 49:03
    Applause
  • 49:03 - 49:06
    Herald angel: Thank you Mike for that
    talk. If you have any questions, we do
  • 49:06 - 49:11
    have the microphones lined up here in this
    row and in that row and does the signal,
  • 49:11 - 49:17
    yes the signal Angel has a question.
    Signal Angel: Yes, so one IRC user asks
  • 49:17 - 49:23
    what are the benefits of using this
    DrRacket tool instead of for example
  • 49:23 - 49:26
    Python which was also developed for
    teaching?
  • 49:26 - 49:31
    Mike: So Python is definitely not
    developed for teaching, not in any
  • 49:31 - 49:36
    meaningful way. So in practice, in
    practice I think the fundamental diff-, so
  • 49:36 - 49:40
    but there's a lot of educational
    initiatives around Python. The thing is
  • 49:40 - 49:47
    really that if you try to name and really
    formalize the techniques the systematic
  • 49:47 - 49:51
    techniques that I showed you and apply
    that to Python programming you will find
  • 49:51 - 49:55
    that very hard. I personally found it
    impossible. Most Python programs out there
  • 49:55 - 49:58
    in practice are just not developed
    systematically and I don't know how to do
  • 49:58 - 50:02
    that. And so that is where that is much
    better. This corresponds to these
  • 50:02 - 50:08
    programming languages were designed in
    lockstep with the didactic principles that
  • 50:08 - 50:12
    underlie them and as far as I can tell,
    I'm sorry about that, Python was not
  • 50:12 - 50:16
    developed with any didactic principles in
    mind whatsoever. Sorry.
  • 50:16 - 50:22
    Herald Angel: OK then. Microphone 2 please
    go now.
  • 50:22 - 50:29
    Questioner: I teach roughly 14 years olds
    in the middle school and also programming
  • 50:29 - 50:35
    and I use the App Inventor right now. The
    App Inventor, MIT Media Lab App Inventor,
  • 50:35 - 50:44
    I […] with scratch and I'm not sure you,
    you said okay you need to buy Lego
  • 50:44 - 50:50
    Mindstorms robots and stuff like that or
    scratch or MIT App Inventor. That's not
  • 50:50 - 50:51
    the case.
    Mike: No. Yeah.
  • 50:51 - 50:59
    Questioner: And what I find difficult for
    the students I have there they are not the
  • 50:59 - 51:04
    best from the best parents, then they
    would like to show something in the end.
  • 51:04 - 51:09
    And it's your program looks a lot like
    Mike: Superball!
  • 51:09 - 51:15
    Questioner: it is really very boring and
    laughter how do you bring it over that
  • 51:15 - 51:19
    point? I find it so valuable that in the
    end they can show it on their smartphone.
  • 51:19 - 51:23
    Mike: Yeah, depending on your target
    audience of course you choose different
  • 51:23 - 51:27
    examples and this example just had a lot
    of things. You might have seen me show the
  • 51:27 - 51:30
    pictures, show the picture algebra at the
    beginning. So that's something that tends
  • 51:30 - 51:35
    to work great for children and older
    children alike and that scales all the way
  • 51:35 - 51:40
    to writing video games and there's an
    entire book that shows children or young
  • 51:40 - 51:44
    people on how to do that. So that's one of
    the great aspects of this. I think that's
  • 51:44 - 51:46
    a fundamental difference to things like
    scratch and so on this approach to
  • 51:46 - 51:50
    programming scales all the way to
    programm-, to professional programming and
  • 51:50 - 51:55
    it scales to substantial video games. So
    the students that we so we always used to
  • 51:55 - 51:59
    do that the halfway point in the first
    semester at the university and they were
  • 51:59 - 52:02
    able to write a complete like 80s style
    you know frogger or snakes or something
  • 52:02 - 52:06
    like that that looked pretty fancy. And
    that's something I think that your
  • 52:06 - 52:10
    children could take home.
    Herald Angel: OK. Then microphone 1.
  • 52:10 - 52:17
    Questioner: Hi, thanks for your talk. I'd
    like to know so your approach adds a lot
  • 52:17 - 52:23
    of let's say overhead that is also
    necessary to be taught. How do you go
  • 52:23 - 52:29
    about the methodology in the actual
    classroom though. Yeah. Do you al-, do you
  • 52:29 - 52:38
    also have some recommendations on how to
    tackle the actual design of the of the
  • 52:38 - 52:42
    class, what methods do you use, do you use
    a flipped classroom or what do you do?
  • 52:42 - 52:47
    Mike: A good point. So so mostly the
    classes that I have taught they are taught
  • 52:47 - 52:50
    just like what I did just now. So I try to
    demonstrate that to really make that clear
  • 52:50 - 52:56
    because it hasn't really been documented.
    I could refer you to friends of mine who
  • 52:56 - 53:00
    have taught a flipped version of that
    which also seems to work quite well. But
  • 53:00 - 53:04
    the important thing really I can't stress
    this enough that as a teacher and I
  • 53:04 - 53:08
    skipped a couple of corners just now to
    fit in the time slot was that you go
  • 53:08 - 53:12
    through all of those motions that you
    always go through all of that motion and
  • 53:12 - 53:16
    that's a great tool not just for giving
    every single step a name but also for
  • 53:16 - 53:22
    pacing the classroom and that and the rest
    kind of tends to fall in place has been my
  • 53:22 - 53:26
    experience, right. No matter whether
    you're looking at you know beginning
  • 53:26 - 53:29
    students or professional programmers. I'm
    not sure I answered your questions but
  • 53:29 - 53:34
    maybe you can take the rest offline.
    Herald Angel: Thank you. Microphone 3
  • 53:34 - 53:38
    please.
    Questioner: Yes. I think this is very
  • 53:38 - 53:44
    great but it is teaching functional
    programming and many people will very soon
  • 53:44 - 53:50
    need imperative programming. How do you do
    the switch or can you do it?
  • 53:50 - 53:54
    Mike: So I I would dispute that but.
    Laughter
  • 53:54 - 53:57
    Questioner: Well if you want to get paid
    for it.
  • 53:57 - 54:00
    Mike: Thank you, go, go.
    Laughter
  • 54:00 - 54:03
    Mike: So I run a company that does all
    their software projects doing functional
  • 54:03 - 54:07
    programming. Ultimately you will need to
    talk about effects. The thing what this
  • 54:07 - 54:12
    does really is I mean if you're writing
    software professionally you know no matter
  • 54:12 - 54:16
    what the language is, large parts of that
    should be functional. So this is a great
  • 54:16 - 54:20
    way to teach good programming discipline
    and a lot of programs out there don't show
  • 54:20 - 54:25
    good programming discipline. So I think
    this would be great to improve upon that.
  • 54:25 - 54:29
    So what this does is it pushes the
    boundary. To be honest I have no idea how
  • 54:29 - 54:33
    to teach systematic development using
    imperative languages. I don't know how to
  • 54:33 - 54:36
    do that. I don't know how to do it and I
    don't know how to teach doing it. On the
  • 54:36 - 54:41
    other hand what I can do that do here is I
    can push the imperative parts of the
  • 54:41 - 54:44
    programming to the fringe and make them
    less important for the success of my
  • 54:44 - 54:52
    project and for the structure of my
    project. So yeah. So you should. This is
  • 54:52 - 54:55
    the good thing because we know functional
    programming works well and we know it is a
  • 54:55 - 55:01
    good foundation for an educational
    discipline. And yeah I can't, I mean there
  • 55:01 - 55:06
    are there are various courses that build
    up upon this, but ask me offline about
  • 55:06 - 55:09
    that that tackle that imperative
    programming.
  • 55:09 - 55:14
    Herald Angel: OK then microphone 4 please.
    Questioner: Yeah I'd like to thank you for
  • 55:14 - 55:22
    your talk too and I'm curious what's your
    experience how many repetitions do you
  • 55:22 - 55:29
    need to teach your students until they
    settle with the principles. Do you teach
  • 55:29 - 55:33
    like three examples or is it up to 10
    examples?
  • 55:33 - 55:39
    Mike: I'm not sure I have a solid rule for
    that. So my experience has been, so I think
  • 55:39 - 55:45
    every principle here usually has like two
    in class examples at the university level
  • 55:45 - 55:49
    and then has maybe three or four examples
    where they do exercises and that's usually
  • 55:49 - 55:53
    enough but your experience might vary. I
    don't I don't think I have a good rule for
  • 55:53 - 55:59
    that. Generally you might not have gotten
    for this but so the point of comparison
  • 55:59 - 56:02
    and where I have the most experience is at
    the university level. Overall the
  • 56:02 - 56:07
    progression of material in here is really
    really fast compared to your traditional
  • 56:07 - 56:12
    Java course. So you can cover a lot of
    material using that. I'm not sure how many
  • 56:12 - 56:17
    how many university students or university
    courses have successful video games in the
  • 56:17 - 56:22
    middle of the first semester and there are
    nice programs that are well structured so
  • 56:22 - 56:27
    so surprisingly maybe even though this is
    so boring and tedious it allows you to
  • 56:27 - 56:31
    write programs successfully quite fast and
    also goes to lots of teaching to go quite
  • 56:31 - 56:35
    fast.
    Herald Angel: OK. Microphone 2 please.
  • 56:35 - 56:41
    Questioner: Hello, thank you for your
    talk. When I learned programming as a kid
  • 56:41 - 56:50
    quite young and I think that I could
    transport tools and the mindset also to
  • 56:50 - 56:53
    mathematics and full blown problems.
    Mike: Yes.
  • 56:53 - 57:01
    Questioner: So I just wanted to ask if in
    your experience can children also use this
  • 57:01 - 57:08
    systematic way of solving, I mean do they
    really make this transition? Can, are they
  • 57:08 - 57:11
    getting better at solving problems?
    Mike: Yeah absolutely they do. So if you
  • 57:11 - 57:15
    look at one of the three projects I listed
    was the Bootstrap Project which is which
  • 57:15 - 57:20
    is aimed at high school students or middle
    school students and there the approach is
  • 57:20 - 57:24
    specifically tied to the algebra part of
    mathematics and so this is where you'll
  • 57:24 - 57:29
    find exactly what you're looking for. And
    that's been that project's been usually
  • 57:29 - 57:32
    successful and they have lots of material
    on how it should be taught. So that's
  • 57:32 - 57:35
    great stuff.
    Herald Angel: Okay, we have two more
  • 57:35 - 57:39
    minutes and two questions. So Microphone 1
    please.
  • 57:39 - 57:44
    Questioner: Hi. How do you measure success
    in your teaching?
  • 57:44 - 57:49
    Mike: So mostly at the university level
    we look at the final exams and we have a
  • 57:49 - 57:54
    few papers out that are referenced from
    the web page there. That's I mean usually
  • 57:54 - 57:57
    what we do is we have pretty close
    supervision, even at the university level.
  • 57:57 - 58:03
    So we look over students' shoulders all
    the time to make sure that we're teaching
  • 58:03 - 58:07
    them at the appropriate level and at the
    appropriate pace. But over the years we've
  • 58:07 - 58:13
    seen measurable improvements by looking at
    the final exams and very specific ones. So
  • 58:13 - 58:17
    we don't just look at the overall grade we
    look at individual problems and see all
  • 58:17 - 58:22
    the progress has been and what we expect
    and there's papers out on that.
  • 58:22 - 58:25
    Herald Angel: And micr
    ophone 4 please.
  • 58:25 - 58:33
    Questioner: Is there some kind of auto
    completion in your editor or do you not
  • 58:33 - 58:37
    advise us to use this feature for
    beginners?
  • 58:37 - 58:42
    Mike: Laughter. No there's not auto
    completion as far as I know. I'm not sure
  • 58:42 - 58:48
    I would advise against it. I know that my
    American colleagues they've I mean as
  • 58:48 - 58:51
    you've noticed write the templates as it's
    sort of always recurring program elements
  • 58:51 - 58:56
    and you could imagine there being a button
    that inserts that program fragment and our
  • 58:56 - 59:00
    American friends they experiment with that
    and they came out not using that in
  • 59:00 - 59:04
    practice anymore. But I can't tell you
    details on how that is. But if you're
  • 59:04 - 59:08
    interested you could send me email and I
    could find out. So for some reason so I
  • 59:08 - 59:13
    can't tell you why and I'm not I'm not
    ideologically opposed to that but we're
  • 59:13 - 59:19
    not doing that.
    Herald Angel: OK then. Mike thank you for
  • 59:19 - 59:25
    that very enlightening talk and become a
    big applause for that talk.
  • 59:25 - 59:32
    Mike: Thank you very much.
    Applause
  • 59:32 - 59:37
    postroll music
  • 59:37 - 59:55
    Subttitles created by c3subtitles.de
    in the year 2019. Join and help us!
Title:
35C3 - How to teach programming to your loved ones
Description:

more » « less
Video Language:
English
Duration:
59:55

English subtitles

Revisions