Sam says you should read this
This blog was created with the BlogFile software, written by Samuel Levy.

You can find Sam on Google + and LinkedIn.
 

Teach a man to fish (and he'll die when he catches Fugu)

Let's talk about how we teach new people to program.

There is a saying which I see getting thrown around frequently in the mailing lists and user groups for programming languages. Everyone knows the saying, and I used the latter half of it as the title for this post.

"Give a man a fish, and you feed him for a day. Teach a man to fish, and you've fed him for life."

This is a common refrain when people ask for resources to learn to program. I see it for Python; I see it for PHP; I see it for JavaScript; I see it in almost every community I'm a part of. People say it meaning that new users should seek out their own resources to learn, rather than bugging experienced users. Google is right there, so why shouldn't people use it? Surely the best resources to learn from will come to the top, because they're the most recommended.

Congratulations, you have taught a man how to throw a line in the water, but not which fish he should/shouldn't eat. In the world of programming education, the fish to avoid would be "most of them".

When you search for anything about PHP (as an example), somewhere in the top results will be W3Schools. It looks authoritative, it has all these lessons, it's right at the top of the list! Too bad that it's poison.

Now let's take a step back, and talk quickly about PHP, the much maligned programming language which runs most of the web. PHP is very definitely not without fault. I'm not about to defend it here (I've done that before), but the biggest problem that PHP has is education. It is a hugely popular language which bends over backwards to make itself easy for new users to learn. It has been evolving for nearly 20 years, and in that time has come from a simple scripting language to a powerful tool, capable of running billion-dollar businesses. During that evolution, it has had more than it's fair share of growing pains, mostly in the form of bad design decisions.

There is a lot of good in the language these days, but unfortunately, the good parts aren't easy for new users to understand. They are high level concepts, based on years of programming theory. PHP still also supports many basic ideas from a simpler age, which were "good enough" for building Mum & Pop business sites, but don't scale well to large businesses. In short, they're insecure, inefficient, and "wrong". They are also easy to understand, and they work.

W3schools teaches almost all of the "wrong" way to do things, which means that new users who use it as a resource for learning will start by learning bad practices, which in turn leads to more bad PHP code, and more people having to learn about how to do things the wrong way. The problem isn't localised to W3Schools, either - almost all PHP teaching resources will spout the wrong, but easy way to solve a problem. The problem is so endemic that I don't think I could, off the top of my head, name a single resource that I would trust to teach PHP.

If you teach a man to fish for learning resources, he's going to pull up the worst possible fish in the ocean, then you will have to clean up the mess. If you hand him the first few fish, and show him where to get more high-quality fish, then you will have won half the battle. If you also teach him why he should avoid the other fish, then he'll be well on the way to becoming a productive member of the programming community.

We need to think more, and harder, about how we treat new users, seeking to learn. With Python, the resources I recommend for most new users are Learn Python The Hard Way if they're new to programming entirely, or the official python tutorial if they already have a language or two under their belt. They are simple resources which explain how to use the language properly. Once they have that base knowledge, then I can tell them where to find more good information.

This is what I want to see. Communities which come together, and create a few good resources for learning, instead of the scatter-gun approach of "just google it". Teaching people to look for answers is an important part of teaching them to program, but you have to teach them what to look for before you send them out into the wild.

So let's not teach people to eat any old thing they catch, and maybe we'll stop having to waste so much time fixing poorly written code.

Comments have been locked for this post.
Johnny Goodman

I'm not familiar with the Python community but I'd say that PHP does this wrong and Ruby does this right.

In the Ruby community, there's an upsurge of support for pair programming sessions to be a standard part of a coder's day. The #pairwithme hash tag is being promoted as a way to meet other's who pair for an hour. People giving their talks are #LoneStarRuby would openly provide contact details and encourage junior devs to contact them so they could spend an hour talking best practices and answering questions inline.

I agree that this is a problem. I don't think google solves this. I think humans talking and watching the process solves it.

 

http://www.thehackernotes.com/

 
michaela

What about http://www.phptherightway.com/ ? I'm a newbie and use this as a reference.

 
Anonymous

That's nice... so W3schools teaches the wrong way, but you provide no discussion of what the "right" way is, nor do you provide a single link to a site which teaches that "right" way.

Which makes this article worse than useless.

 
Anonymous

the C/C++ community tends to yell and make rude comments like "i didn't spend 20 years learning C just to show you how to do X"

this will tend to push people away... i've seen it in other lang communities too