The challenge of teaching yourself a programming language
Programming as a profession requires a great deal of learning on one’s own. Whether you think Universities should or should not be in the business of providing job training for software development, the fact is that the industry moves far too rapidly for Universities to teach more than a small portion of the knowledge required to be competent on the job, even at an entry level.
Teaching oneself involves more than just reading a book and playing around, sometimes it involves taking time to investigate the parts that don’t immediately make sense. (Note that those steps are the shortest, simplest path from confusion to understanding; it might take someone more work than that, but the fact remains that there is a simple and reasonable path to understanding and that it isn’t particularly hard to find.) If one does not know how to learn on one’s own, self-teaching is the wrong choice…
You have to take responsibility for teaching yourself, and that is a far greater responsibility than skimming a book and fooling around copying and pasting code from web pages. You can’t just take basic or even sketchy knowledge of how to program in one language and “transfer” it to another language. You think
you can just “pick it up,” but in reality you can’t, and neither can I. Even Peter Norvig needs ten years
to learn a new language.
Essentials of Programming Languages introduces programming languages in one of the strongest ways possible: by building a simple interpreter for each language concept (The “P.J. Plauger” method). There are other important ways to learn a programming language, but none will teach you as much about how language features actually work.
Returning to the quote, there is a temptation to think of learning a new language or system in terms of your facility with problems you set for yourself. Meaning, you pick up a new language and immediately try to perform some task with it. A task you choose. And you probably have a preconceived idea of how to go about solving the task. And when you have successfully performed that task, you think you have learned the language.
When put this way, it is obviously nonsensical. It is like writing a test where you choose the questions.
But this type of thinking leads to skirting around or avoiding anything confusing or “difficult.” This type of thinking avoids anything truly new and different in favour of using the new language as closely as possible to how you use your existing languages. And that means that you really haven’t learned anything worthwhile, just some new syntax.
To truly learn a new language, you have to learn the different things. When you find something difficult, something that doesn’t make sense, you don’t avoid it, you embrace it
. This is where the actual learning takes place. For example, it is possible—even easy—to write Ruby programs that do not use blocks. They work just like Java programs. But of course, such a program isn’t really a Ruby program in any substantial sense. If you were to avoid blocks because (a) they look weird, and (b) you can write your program without them, in what sense have you learned how to program in Ruby?
Imagine yourself as a master carpenter who is training an aspiring apprentice. The apprentice has assembled some Ikea furniture and decided he likes carpentry, so he’s going to give it a whirl. One day, he brings in a stool with a leg that needs replacing. He says, “I’ve been trying to remove the leg, but the screw is just stuck or something, and I think something is wrong with it.” You look, and ask him to show you how he’s tried to go about it. He picks up a screwdriver and desperately tries to fit its flat head into the cross of the phillips screw. You tell him to stop, take out a phillips screwdriver, and proceed to unscrew things easily. He gawks and asks, “There are different kinds of screws that need to be treated differently?”
Imagine your horror. How could he not know something so basic? Aspiring to be a carpenter requires understanding the tools a carpenter uses. Likewise, aspiring to be a programmer requires understanding the tools a programmer uses. [ibid]
When learning a new language or tool, do not shy away from things that seem different, weird, confusing, counter-intuitive, or unfamiliar. Do not put them off because you can work around them. Learn them, try them, and persist with them until you discover why
they make sense. This is the true road to teaching yourself a new language. And in today’s fast-moving industry, it’s a road we all share.