I have been asked for advice from several people recently on how to get started programming, or how to further develop a nascent interest in coding or software engineering. The people asking the questions range in age from about 10 years old to older than me. These are people that, for various reasons, are not very easily able to take computer science courses right now.
One would think that, since I’ve been doing this for somewhere around a quarter century (oh I do feel old now), that I’d be ready to offer up some great advice. And offer some suggestions I have. But I’m not convinced they’re good ones.
I have two main tensions. The first is that I, like many in the communities I tend to hang out in such as Debian’s, have a personality that leads me to take a deep dive into details of anything that holds my interest. Whether it’s Linux, Haskell, or amateur radio, I want to do more than skim the surface if I’m having fun with it. Many people are not like that. They may have a lot of fun programming in Visual Basic, not really caring that other languages are out there. Or some people are not like this yet. I feel unqualified to provide good advice to people that are different from me in that way. To put it a different way: most people don’t want to wait 4 years to be useful, and want to start out right away and get better over time (and I was the same way too.)
The second is related. I learned programming at a time when, other than BASIC, interpreted languages were not really available to me. (Yes, they were available, but not to me.) I cut my teeth on BASIC, Pascal, and C. Although I rarely use C anymore, I can still drop into it at a moment’s notice and be perfectly comfortable. I feel it was a fundamentally valuable experience, and that it would be very hard to become a great programmer without ever having lived and breathed something like C, where memory and pointers must be managed manually. Having said that, it is probably possible to become a good coder without ever having touched C.
Here, then, is an edited version of some rambly advice I sent to someone recently, where learning OOP was particularly mentioned. I would welcome your comments and suggestions. I may point people that ask to this post in the future.
For simply learning how to write code, Dive Into Python has long been a decent resource, though it may assume more experience than some have. I haven’t read them myself, but I’ve also heard good things about the How to Think Like a Computer Scientist series from Green Tea Press. They’re all available as free PDF downloads, too!
Eric S. Raymond’s The Art of Unix Programming is another work I’ve heard good things about, despite having never read it myself. A quick glance at the table of contents makes me think that even if people don’t wind up working on Unix, the lessons and philosophy should be informative.
It seems that many Computer Science programs are using Java for the core of their instruction, or even almost exclusively. Whether that is good or bad, I’m not completely sure. It certainly gets people into OOP more deeply, but I’m a “right tool for the job” kind of person. Despite the hype, OO — like everything else — isn’t the right tool for every job.
It is fine for people to dive straight into OO and become good programmers/engineers. However, I think it would be difficult to become a great programmer/engineer without ever having a solid understanding of a more low-level language, such as C in particular. I did my CS work when it was mostly based in C, and am glad for it. If someone never has to manage memory or pointers, I suspect they will be at a disadvantage in the long run for not being able to understand or work with the system at a more fundamental level. If a person knows C, plus some concepts of OO and Functional Programming (FP), it should be easy to pick up just about any other language out there.
I used to think Python was a great first language, but during the 2.x series they added so much fluff and so many special cases that I’m less enthusiastic now, though I don’t know how much of that got cleaned up in 3.x. I am not too keen on Java as a first language, because too many things that should be simple aren’t. I have a fondness for Haskell, and its close relationship to mathematics could make it a great first language — or maybe a poor one, depending on your perspective.
One other thing – I think it’s important for good programmers to have experience with all three major models of programming (procedural, OO, functional.) Even if a person winds up working mostly in one universe, knowledge of and experience with the others is important and informative and, in my experience, leads to better algorithms and architecture all around.
- Procedural languages: Obviously C, but also Unix shell
- OO languages: Python, Java, plenty of other fine choices
- Functional: Lisp, Scheme, Haskell (also the only lazy and pure language on this list)
Having said all that, more important than a choice of book or language is experience. I have heard people suggest that it takes 10,000 hours of practice to become a superstar at something, whatever that “something” is, and I wouldn’t doubt it. Seth Godin discusses that a bit, with some criticism of the idea too.
So that leads to the most important piece of advice: dive in to whatever your interest is. Experiment, write code, put theory into practice in a way that holds interest and excitement. People that try to do things they don’t enjoy don’t seem to stick with them as long or execute as well, and thus will never become great.
Dive into Python has a reasonable amount of introductory material, but in general it assumes you already have some programming experience. For a truly introductory text, try “Learn Python the Hard Way”.
I’d also suggest that The ANSI C Programming Language works as a good introduction, either as a first or second book.
The K&R book is a good one, but probably moves a bit fast for a beginner. Thanks for the “Learn Python the Hard Way” suggestion.
I’d second the recommendation for “The Art of Unix Programming”; having read the whole thing, I found it quite good.
“How to Become a Hacker” and “Asking Questions the Smart Way”, while not directly programming-related, definitely seem like required reading. And I’d recommend a cover-to-cover read of the Jargon File (AKA the New Hacker’s Dictionary) as well, or at least the introduction and appendices.
I hadn’t read “How to Become a Hacker” before. I took a look at it. A nice work, and it pointed me at Norvig’s “Teach Yourself Programming in 10 Years”: http://norvig.com/21-days.html — an excellent read.
Having a set of problems you want to solve, and someone who can tell you if the problems are easily solvable was required to get me started. My father tried to interest me in programming in ~1986, to no avail as I didn’t have a problem to solve. A CS class (really independent study) got me into it.
Just wanting to be a programmer doesn’t cut it to get going. A good start also needs to get you to understand what can and can not be done by a computer.
I have practiced another way of increasing interest in other people for computing stuff: microcontrollers. There is nothing fancy in the programming, but you can teach a board your own new or old tricks. You can feel like a “creator” in some sense. I found this particular aspect to be nicely discussed in the book “Hackers” by Levy. Apart from getting going, you “must” have a project IMHO. Otherwise you will lose interest when things become complex and answers are not 5 minutes away.
I am curious about the Python 2 fluff you mention. Do you have examples or a post somewhere about it?
There are a ton of double-underscore class methods that can make things behave in unexpected ways. I appreciate the idea of lazy lists, which work great in Haskell, for instance, but I am not sold on the “list or list-like” concept being one that meets the KISS principle in Python.
I can wholeheartedly recommend TPTHW and other (mostly in the works) LCodeTHW. Not only are they aimed at beginners but Zed’s very encouraging – both in the foreword and throughout the book – which is very important for anyone, especially a beginner.
Wow, those are excellent suggestions. I read the first few pages of LPTHW and it reminded me immensely of how I learned with BASIC, and then Pascal: some simple examples, trying out a few things, etc. Thanks for that great suggestion.