2012年1月23日月曜日

Why Teach Programming

why teach programming

« Inspired by Kanye | Main | Oh here we go »

Teaching is actually kind of hard

Have you ever seen something that you wanted to be really good, but realized, no, it wasn't? Like, you were thinking this could be awesome, but then when you get into it, you realize it's just kind of...bad. Yes John, we know, Star Wars Episodes 1-3, let it GO.

HAH! Stupid voices inside my head, that wasn't what I was talking about.

No, but you were thinking it.

Shut up, go back to building the harp trap.

W00t! I'm outta here!

Okay, now that's done. So here's the thing: there are a lot of people a lot who have an interest in learning how to program, and would like to teach themselves. The problem is, pretty much every self-paced course makes the same mistake: it leads you through a bunch of rote lessons, that you fundamentally don't care about, and you lose interest because you can't stay interested enough to remember what you did ten minutes ago.

Those are the good ones. The bad ones leave out info that a n00b would care about, are inconsistent in their presentation, etc. Which brings me to the subject of this post...CodeYear. When I first heard about this, I did enough research to realize that it was a cool idea, and was in a language I've wanted to get better at for years: Javascript. I don't do real well with dot languages, but JS actually has some value in my personal and professional life, so I've some motivation. I'm also not new to programming, I've done it in a few different environments over the years, including some visual 4GLs, and of course, my latest fun toy, AppleScriptObjC.

So I'm new to JS, but not programming in general. Hell, almost finished that CompSci degree once.

But I get into CodeYear, and well...damnit. The first day, the day when you want to hook people...and it's just rote monkeywork, boring exercises, and inconsistent presentation. For example, semicolons. Now, some languages require them. Some don't. In JS, they're optional. However, if you're going to use semicolons, then explain why they matter, why you're using them in the lesson, and enforce their use. Even if it's just for "if you ever want to learn a different language, this is a good habit to get into". But be consistent. Don't say "you should use a semicolon after each statement", then, when I leave one off accidentally, not even mention it.

Really, here are my thoughts on it as I'm going through day one:

it's monkeywork. For example, i messed up because I forgot a semicolon. Instead of taking that as a chance to teach me why that's a bug, it just tells me I screwed up and moves on. In another example, I deliberately left off the semicolon, and now I don't get an error. So do I need that or not? If I'm new, I don't know.

Why isn't there a semicolon in the substring() lesson

Sams Teach Yourself Beginning Programming in 24 Hours (2nd Edition)
Learn moreGreg Perry

I did it right, but I used a different word. you don't care that I still don't know why I don't need a semicolon all the time, but you're fussing about me doing it RIGHT, just with a different word?

If it seems picayune, maybe it is, but again, I am actually new to JS. I couldn't code my way out of a paper bag in that language, and I actually want to learn, but it keeps throwing up reasons why I don't care. For example, that last one:

I did it right, but I used a different word. you don't care that I still don't know why I don't need a semicolon all the time, but you're fussing about me doing it RIGHT, just with a different word?

WHY THE FUCK WOULD YOU DO THAT? It was in the word substitution lesson, wherein I learned that if I use the wrong word, even though the code is valid, CodeAcademy tells me I did it wrong. I didn't do it WRONG, I used a DIFFERENT WORD. Christ, when a student wants to explore, you don't slap their hand, you encourage that. This is teaching 101: encourage students to dig into the material.

Yes, I know, a lot of this is a function of that robotic console shit they use, but that brings me to another point: If I were to ever use JS, I'm using it in a browser not the CodeAcademy console. So why are you teaching me a bad habit, and not even telling me that "Hey, this isn't really how you're going to use JS, but for our first baby steps, it will help us focus on JS, not reloading pages in a browser." If you really wanted to get uppity, and you were a bit clever, one of the first things you'd teach someone is how to set up the browser to do what the console does. Even if it's an overly simplistic thing like a button on the screen that says "Test code" and just reloads the page, that would be something of immediate use to the student. Nope. Nothing. "Do what I say, exactly how I say it. All independent thought will be in error."

Also, "oops, try again"? Not a really helpful criticism of a mistake. Keep in mind, this is just part of the first day. Some other comments in my brain dump document:

Now I'm using methods, and I don't know why. what the fuck is this for? Do I memorize this and hope?

I'm on lesson 4 of day/week one, you are jamming methods down my throat, and that's a LATER?

There is a lot of this in CodeYear. "Just do this, we'll explain it later". Fuck, do you really not want me to ever learn anything but how to type what I'm told, where I'm told, when I'm told? This isn't even GOOD rote learning at this point. I'm not even through day one, you've dumped methods and functions in my face, but I don't know why, or what the fuck they are, so I hope that by the time you get around to explaining shit, I'll still be here. (well, fortunately, I do, but if I really didn't know anything about programming? Ye Gods. Also, I won't be here, so I guess it never mattered.)

Sams Teach Yourself Shell Programming in 24 Hours (2nd Edition)
Learn moreSriranga Veeraraghavan
you hit me with a series of things that require function parameters, then you hit me with one that doesn't, and you don't TELL ME WHAT'S UP?

Again, thank Cthulu I know about void returns and functions that don't need parameters. But if you teach people a bunch of functions with parameters, like substring, and then you hit them with one that doesn't, (hell if I remember which one, I only remember substring because it's in my notes), this is a great time, an AWESOME time to say "So, you may have noticed we didn't put anything in the parentheses. Don't worry, that's normal too, and here's why....

And then...

oh holy fuck, I'm on arrays now, and I don't know what the fuck is going on.

Literally, out of nowhere, arrays. I would hope they have a reason for flooding you with this, but I don't know. Shit, they never explain what the period is for, or the general order of things with regard to periods. Or that it's called a "dot" not a "period" in this context. It's like starting at zero:

why do I start at 0? Is this a computer thing, a javascript thing, or another "shut up and do this" thing.

Well, with CodeYear, it's clearly "shut up and do this". Look, sometimes you don't need to give the complete explanation of the history of starting at zero. For beginners, it's cool to say "We start counting at zero in Javascript because a lot of earlier languages did that, and so this way, we're consistent with them. It's more of a tradition and a convenience than any technical need, so as long as you remember that in Javascript, we always start counting at zero, you'll do fine."

That's the level of explanation that works for n00bs. It's like what my mom said when I asked her in public, at the age of six, "Mommy, where did I come from?" Her answer? "Chicago". It was a correct answer, (I was in fact, born in Chicago), I knew that people are from Chicago because most of my family is from there, and so cool, I'm from there too. Note how it was a correct, concise answer that would later be filled out with supplemental data, but at the time, given that I was a n00b at life, it was probably the best answer. It must have worked, I'm told I was happy with it, and didn't need any followups.

The problem with CodeYear is that it's not teaching me anything. It's trying to jam Javascript down my throat, but it's not teaching me programming. What's the goal? Well, the goal is, I'll know Javascript. But that's like learning German to learn German, without ever planning to go to Germany, or having some abiding interest in German culture or society. There are people who learn like that and for that reason, but they don't need stuff like CodeYear. They'll learn it on their own.

Sams Teach Yourself Object Oriented Programming in 21 Days
Learn moreAnthony Sintes

CodeYear should be for people who want to learn Javascript, and even have some things they'd like to do. It's for people who see a lot of cool things in Javascript, but would like to be able to do more than copy/paste code. I'm doubtful CodeYear will help many of them, because if you can't get someone excited about what you're doing in the first lesson, when you haven't had time to bore them or piss them off or whatever, if you can't hold their interest for that long...yeah.

The real issue here is what's the point? What can I do with this? Not some abstract bullshit like "Well scripting is the lingua franca of the modern Internet." Way to go PretentiousMan. Again, for the people who get that, and can be motivated by that, they don't need CodeYear, they just need a decent book or two.

Here's what I would do: Build Pong. Make the idea behind CodeYear that we're going to build a simple video game. Pretty much everyone with a computer has either played, knows about, or at least heard about Pong, and most people like games, even if they aren't gamers. It has the attraction that a game has, and in its own simple way, deals with some pretty complex things, like animation, momentum, etc. So it's a definite, easily recognized goal that is fun, and as Cos said, "If you aren't careful, you just might learn something."

Start by analyzing pong. What do you need to do to create Pong? Well, you need to create a place to play Pong, an area in a window. You need to draw the pong playing field. You need to move the paddles. You need to keep score. You need to know when someone has scored. You need to be able to tell when the ball and the paddles intersect. You need to move the ball. You need to not allow the paddles to move out of the playing area.

That's incomplete, we're leaving out the interesting things you can do by hitting the ball with a moving paddle, and what about corner hits, or hits with the top of the paddle. There's also figuring out the order in which to create the various parts of Pong, and how to test them out. Debugging. Design. The important stuff of programming that you need regardless of language. If you teach people that, even if they never use Javascript again, you'll have helped a lot of people know a lot more about what's happening on their computers and why.

Pong is a great chance to teach people programming, and then use Javascript as a way to implement Pong. You can start simple, and them help them find their way into the game, and all the stuff we care about. While you're doing that, you can start a gentle introduction to things like functions, methods, branching, proper coding design, etc.

Most importantly, you're teaching people how to use programming and Javascript to create things. You can give them hints as to ways to change the color of the game. You can teach them how to experiment in code while always leaving themselves a way out of any rabbit holes they wander into. (Pro Tip: teach that comments are not only a way to explain the code, but a valuable safety net when you want to play.)

You're teaching, not just lecturing, or worse, drilling.

I really wanted CodeYear to be awesome. I want to learn Javascript, I have things I'd like to do with it, but the syntax is just hard for me to learn and retain. Rote will not work for me, and judging by the comments from a lot of other people who gave up faster than I did, it's not working for them either. CodeYear is just another group of geeks the same mistake everyone makes with teaching programming: they think teaching, as a thing, is easy.

It's not folks. Teaching, as "soft" as skill as it may be, is really hard to do well. You have to manage, lead, inspire, guide, correct, encourage, praise....all of it. The only people who think that's easy are the ones that suck at it. I've taught before, I know how hard it is to do well. I like CodeYear's enthusiasm, I think their hearts are in the right places, but heart and enthusiasm are only inspiration. You still have to do more than dump information on people and assume they'll get it.

Categories:     Other

Posted by John C. Welch at 10:29 | Permalink

©2003-until I'm fucking dead and then some. you steal my shit, and I will fuck with you like you were a lonely shepherd's slowest sheep.

Warning for Notes users: The commenting system uses HTML.
I know this will be scary for some of you, especially Notes fans. However, open standards, rah-rah.
If you want to use less-than or greater-than signs, or other similar characters that HTML reserves,
you'll simply have to learn to do it the HTML way. Luckily, HTML is kind of popular, no matter what
your re-educators have told you, and you can easily find help on the intertubes.

0 コメント:

コメントを投稿