1. 1

  2. 7

    Programming Education. I got this.

    I think the comment by @moses sums up the current theory about what people of the last 5 years think a good beginners' programming language is. I agree with probably none of them wholeheartedly, but I have indeed heard all of these notions over and over again. The only successful computer science curriculum for beginners I’ve seen scientifically measured is the one done by Harvey Mudd College where they present a combination of languages to exhibit theory first and practical application later. They also require all students to take the intro to CS course.

    The post is biased toward people involved in the industry or aware of it in order to make decisions about learning a language that is immediately applicable. You don’t really need to do that to pick a beginning language, although you can certainly learn to code on-the-job, where such a choice is not up to you. Frankly, to properly learn how to program, it’s about intuition, and no one language is going to help you. If your goal is to be an expert programmer (is that a valid goal these days?), you’ll need fluency in at least 3 languages, so who cares which one is the first? You should not have to approach programming with the idea that you have to ‘know exactly what you want to do.’ People generally don’t have a project idea beforehand, although it would help.

    If you are picking a language for somebody who has never programmed before and doesn’t know if they would like to, then the choice is critical. If they have a project goal, then some mentorship can choose the correct one, and then their learning is project based. You teach them arrays when they need arrays, etc. Mentors are rare, so how about self taught? They’ll fumble around, but eventually come to incorrect conclusions, and eventually somebody will correct them in some condescending manner, and they learn. If they do not have a goal, then essentially they need to follow programming as a study and learn from fundamentals onward.

    So, about that classroom setting (or self-taught from a book/lecture videos/etc)? Well, the choice is no longer theirs, because they don’t know anything yet, so what is the best? If your goal as a teacher is to give the basic fundamentals, then you start with the machine itself, plus a little theory. Describe the bounds of what you can and cannot do. Describe what a Turning machine is. And then, after a few weeks, maybe you write some code. It doesn’t matter what the language is, because you’re at the point where you get to say ‘this is a written abstraction of that machine,’ because at the fundamental level, you must expose all magic by describing why such abstractions are necessary.

    But, we need immediate feedback loops, they say. For some people that already know what they expect the computer to do, and know that it is not magic, this is good. Give them a REPL, and they can determine how best to complete a task. If they are not aware of the abstractions of a language, then you get to the point where such immediate interactions create the opportunity for somebody to simply try every combination they can think of and either 1) get the result they wanted, but do so accidentally, or 2) do not get the result and become frustrated that their idea of expressing something was not understood. You must demystify the idea that the language is not natural. That’s hard. The more expressive the language, the harder it is, dispelling the belief that this helps beginners as well.

    We need a language that has a large community, they say. Well, that’s actually quite true. You see, in all of the time I’ve taught students and graded students and mentored students… there is one thing that is always true: the good ones cheat. They ask everybody around them to look at their code, to fix their code, to write their code for them. That’s against the rules where I taught, but whatever, it’s a good thing if they’re being interactive about it. And they usually will be because my written exams scare them.

    What should we do as mentors, teachers, etc to promote people to learn to code?

    1. Do our best to promote diversity and fight against sexism and racism and other discrimination in our tech communities especially in public spaces, but private spaces too.
    2. Dispel any notion that it is difficult to learn and you aren’t supposed to learn everything.
    3. Be modest about our abilities, because we’re all kinda terrible honestly, because we cannot learn everything. Especially be modest when teaching or mentoring.
    4. Never discourage a question.
    5. Always give a thorough answer. (I think I’m good at this one :P )
    6. Promote knowledge of basic computational theory, because knowing the limits of what any programming language can do or any computer for that matter is something every programmer should know and respect. A programmer that doesn’t know basic computational theory is like a carpenter that doesn’t know that steel is harder than wood.

    To end, the notion that people learn programming to ‘become good programmers’ is a silly notion. That may be true to begin with (“I want to be a pirate!” —Guybrush Threepwood) but if you continue learning to code, that original motivation must change. It must mutate into some goal that is worthwhile to the person. You might originally want to be ‘good at drawing,’ but in the end you want to ‘create a work of art.’ Because at the end of the day, nobody is a good programmer, and certainly nobody is great. The better you are, the more you realize how bad you are. We eventually taper off to become eventually good at whatever we need to be eventually good at doing. And then we create worlds one insignificant piece at a time.

    1. 1

      Thanks @wilkie for the thorough answer. I especially enjoyed the #1-#6 list in regards to what mentors/teachers should do.

      You should write this up as a post as it would be helpful to others.

      1. 1

        So would you argue it’s better to not have a REPL? I feel like I current use good REPLs like bpython as learning tools for myself, which is probably why I like them. It seems like your argument is that REPLs can be discouraging because they encourage constant, random experimentation, without first teaching students to think carefully about what they do.

        I found that I didn’t learn properly how to think before doing until I wrote a lot of multithreaded code and took an Android hacking course, where kernel compilation + loading the android emulator + loading the code onto the emulator + running the code took fifteen minutes to an hour. I feel like, “A week’s worth of hacking can often save an hour’s worth of careful design and planning” is an advanced topic, although I could be biased because of my own education.

        I feel like the most compelling way to present Turing machines is, “You know everything you now know how to do with X (powerful programming language)? Well, you could do it all with just a Turing machine.” Presenting Turing machines as being the explanation for what computers can do seems bounding, and like it will make students underestimate computers, because I certainly underestimated Turing machines when I first read The Diamond Age. Have you had good experiences with this method of explanation?

        Also, what language is sufficiently weak enough, and has a long enough feedback loop for you? I personally like Karel—it’s compiled, so you can learn from the compilation errors and its feedback loop isn’t too fast. Furthermore, it’s not at all expressive, the problems are very clearly defined, and you can visually see results without resorting to printlns, which feel sort of primitive.

        1. 3

          I teach Ruby and Rails professionally, and also volunteer and teach to kids. We do use a REPL, but some people find switching between the two ‘modes’ a bit confusing, so we generally only use it to introduce the most elementary concepts. As soon as you’re writing methods, switch to a file.

          But for the first few hours, it’s great.

          1. 1

            @steveklabnik – where do you teach Ruby and Rails professionally? Do you mean to students or working alongside other developers?

            1. 2

              http://jumpstartlab.com/ , and volunteer with http://codenow.org/.

              Do you mean to students or working alongside other developers?

              We have a variety of clients. Sometimes it’s basic Ruby and testing to QA teams, sometimes it’s intermediate Rails for Java devs, sometimes it’s advanced Rails topics with existing, experienced Rubyists.

              We also did all the instruction and curriculum development for Hungry Academy in partnership with Living Social. We’ll be running http://www.gschool.it/ next year, as well.

              1. 1

                teaching and volunteering to help under-represented demographics – you are a “ruby hero”

                1. 1

                  I try!

                  (also: http://rubyheroes.com/heroes , haha!)

      2. 4

        I think that this makes sense under the assumption that learning a programming language is hard. But after you’ve learned your first programming language, you find that the next is orders of magnitude easier. Really, it’s just understanding the concepts that underly it that are hard. Really, for your first programming language, you want a good language for beginners that will teach you the concepts well, not necessarily the most powerful or expressive ones, or the ones that will still be relevant in the future, or is even relevant today.

        I think that your first three points are on the mark, but the fourth is off.

        1. It is important to use an expressive language that you can do real things in because it can help you to motivate yourself. However, Logo or Alice might be just as good at this, and depending upon your problem domain, something like perl might also work well. Rails is extremely expressive, but also magical. I don’t think learning Rails as a first language is that great an idea, because of how magical it is. I think Sinatra has a good balance of magic and power, although you do need to roll your own for a lot more things.

        When it comes down to it, I would probably recommend python as a first programming language under this criterion, because it presents a “right” way of doing things, but is also extremely powerful and flexible. It is useful in many different problem domains, and has very good libraries. Ruby is also like this, but it is TMTOWTDI, which I think is not great in a first programming language.

        1. Short feedback loop is very important. Use an interpreted language. It doesn’t really matter which one. Anything with a REPL. You can learn patience another time. Python, ruby, php, lisp, all have very short feedback loops.

        2. Something with a big stackoverflow community. Python, ruby, php, java, c, etc. Easy to look up.

        3. Future Relevance: learning a language isn’t a big investment after you already know one, so this is not important.

        I used to think that it was important for a first language to be low level, so that you can appreciate what the computer is doing for you, but now I think it’s more important for it to be expressive, but not magical, so that you can understand the concepts, but don’t get discouraged by seeing too much of the metal.

        1. 1

          After you’ve learned your first programming language…” is a massive barrier entry. With no scientific data, I was guess 9 out of 10 people who at least casually try to learn to program, ultimately fail – just a guess.

          My final decision was a choice between python and Ruby. The deciding factor was two-fold: access to director mentorship (smart rationale) and I saw Ruby all-around in the tech startups I worked with (not-so-smart rationale).

          1. 2

            Right. I know that the first programming language is hard. My argument is that the first one doesn’t matter, except that it should be easy to learn. If you go in depth in Karel, or Logo, or Alice, that’s probably good enough, despite how weak/useless the languages are. If you have a million different possibilities, and they all have different difficulties, but then after doing one of them, any one of them at its real difficulty, all the others are one hundredth as difficult as their nominal difficulties, you would choose the easiest one, because the difficulty of learning a good learning language, and then any other, harder, but maybe more useful language, will be easier than just learning the harder language.

        2. 2

          The truth is, it doesn’t really matter what your first language is if your aspiration is to become a good programmer.

          Learning to program well is something that transcends languages and platforms. Usually a community will focus on a specific aspect of solving the problems you typically solve with the language, and pretty much all of them have something to teach you. Even if they don’t, the language will.

          1. 2

            But your first language probably shouldn’t be INTERCAL.

            1. 1

              Nerd humor – awesome!