Tuesday, May 15, 2007

How to become a programmer in ten easy steps.

A cousin of mine recently told me that he wants to switch jobs. He wanted to become a programmer! Specifically, he wanted some advice on becoming a programmer quickly. He's a really smart guy. I have no doubt that he can learn everything he needs to become a programmer.

Can he do it quickly? Well, I didn't learn very quickly. I started somewhere in elementary school, and I did it as a hobby for a long, long time. I still have a ways to go before I can unequivocally say that I'm good at it.

That's not really what he's asking, though. He's asking what it takes to switch jobs to become a programmer. It's much better to get paid while you learn, so he wants to land a job as a programmer and continue learning. What does that take?

I discovered that I have no idea. No one hired me when I was learning in elementary school. I wouldn't have hired me until I'd learned how to deal with complexity in software. There are a lot of really bad programmers who have been hired, but my cousin asked me, so I answered with a description of how to deal with complexity.

I should point out that he's already an engineer, and he expressed some interest in academic research as well. Programmers obviously have more fun than other engineers, so I had to rebut those possibilities as well.

I think the real breakthrough that I made that started me on my way to becoming a good programmer is to realize that it's all about psychology and only minimally about algorithms. Most beginning books that I've flipped through don't talk about complexity at all. Let me explain...
Computer software these days is unbelievably complicated. A common metric for measuring the complexity of software is to measure the number of lines of code in a program. Windows is around 10 million lines, for example. (I'm making the number up.) That's 10 million individual parts that all have to work reasonably well together. This is the sort of complexity that's impossible with mechanical parts; mechanical parts simply aren't reliable enough to make something that complex. The only competition for complexity is in circuit design, and I can argue that this isn't as complex as software, either.
Computer programming ends up being about the management of complexity much more than about algorithms. I get into about 100 times more conversations at work about hiding complexity or managing information than I do about algorithm design.
Once I figured that out, my programming skills got enormously better. Now that I've figured that out, writing code is a lot like writing an essay. I'm writing to an audience, and the audience has to understand my point immediately. It's a bit harder than writing a essay, though, because you also have this secondary audience of the complier/interpreter/computer. The compiler has to have the same understanding as the primary audience.
This probably does a lot to remove the glamor from software development for you. However, you should understand that making a million lines of code (or even 10 kloc) understandable to a human being is a very serious undertaking. It's a really non-trivial problem, and people are still trying to figure out how to do it easily. (This includes university research groups, but the funding is higher within companies.)
Here's an example of a really serious problem that hasn't been solved, yet. I'll assume you know about Moore's Law. Until somewhat recently, Intel and AMD have made CPUs faster and faster by accomplishing more per clock cycle and performing more clock cycles per second. Now the speed of light has gotten in the way, and they have to make collections of CPUs on one chip that work together to solve a problem. This has the interesting side effect of moving the problem of speeding up computers from the chip designer to the software developer!
In order to solve the problem, software developers have to write software that does more than one thing at a time. This has been done a lot by computer programmers before, but only by good programmers! It's not easy to do. Suddenly, Moore's Law is in jeopardy not because of lithography limits but because software is too complex to write! It's a potential crisis that's looming in the industry now, and a lot of people are working hard to solve it.

I hope my cousin does become a programmer. He's a bright guy, and if he finds it interesting, I'm sure he'll do well eventually. I also wonder if I'm hoping that he won't learn quickly. I certainly didn't. Maybe I just wish that the code I wrote way back when I was learning was a lot better than it was!

This originally appeared on PC-Doctor's blog.