A friend turned me on to this essay from Peter Norvig entitled Teach Yourself Programming in Ten Years. In it the author attacks the idea of the "Teach Yourself C++ in 21 Days" kind of books. They make it look easy to learn to program. Unfortunately, it isn't. You can't become a good programmer in a month. In fact, you can't become a good programmer in a year. You don't need to go to college to learn how to program but it helps. Learning on your own is a lot of work. Learning to program is like learning anything of value. It takes a lot of practice. The essay quotes research indicating it takes a decade to master any significant skill.
Norvig gives some good advice on those who want to become programmers. Most of it, like just get out there and program, is great advice but is also common. A few though, are less commonly stated and deserve repeating. Among these are:
- Work on other people's programs. Learn a program written by someone else. This will teach you how other people have solved problems and will teach you how to write maintainable software.
- Learn a half dozen languages. Learn languages that have different approaches to programming. Each new sort of language will open your horizons and help you see problems in different ways. Solving a problem in C will lead you in different directions than solving the same problem in Smalltalk. Unless you know both languages, you'll likely fail to see one of the solutions.
- Understand what's going on below your language. Modern programming languages are so high level that it's easy to forget that there is a real machine running the code. However, as Joel Spolsky says, all abstractions leak. That is, there will always come a time when you have to understand the layer below the abstraction to solve a bug. If you understand how memory works, how drives work, what makes a processor stall, etc. you'll be better off. I see this often in those we interview. They understand a programming language but they don't understand the operating system. If you don't know the difference between a thread and a process or if you cannot describe how virtual memory works, you'll be at a loss when things go wrong.
There is advice here for many people. If you are learning to program, the application is obvious. Not so obvious is that if it is going to take you a long time and a lot of practice, you're going to have to put in work on yoru own time. You won't learn to be a good programmer without spending your evenings/weekends doing so. However, there are other things we should take away from this. If you are a manager and you are trying to grow young programmers or new programmers, you need to give them explicit time and opportunity to program. No one can just take some classes or read some books and become a programmer. For those who are experienced programmers, it is a good reminder to read the code of others. If you work at a big company, you can look at the code of those around you. Seek out those who are more skilled than yourself and examine how they solve problems. If you are at a smaller company, seek out open source projects. See how they do what they do.
Here's a piece of advice that the essay doesn't mention: rewrite your programs. Each time you'll have a better understanding of the problem domain and thus you should be able to solve the problem in a more efficient way. You'll learn how much you've improved when you see your old code and you'll learn to approach the problem in a new way.
Read the whole essay.