Friday, October 30, 2009

Programming is more than pointers and recursion

I apologize for last week's dry and boring post. This isn't a news blog, and it won't become one. I chose that topic because I was desperate to write about something relevant to programmers and the tech community, not because I wanted to write about it. Now I will only write about topics that interest me, topics that I can offer a unique perspective on. I won't become a me-too blogger.

...and now, for the reason you're reading this.

Today, I read a 2005 post from the venerable software-development blog Joel on Software about the problems with colleges teaching Computer Science through Java. I recommend you read the article before this post, but, to summarize, Spolsky says that because Java doesn't emphasize pointers and recursion, it isn't a suitable language through which to teach Computer Science. Here's why he's wrong.

Programming is more than just solving puzzles

First and foremost, I disagree with his view on the purpose of a CS program. He thinks that the goal of a college's CS program should be to weed out the students who aren't smart enough to succeed as programmers. Furthermore, he recommends that pointers and recursion should be taught as soon as possible to scare off the posers. That's poppycock.

The goal of a CS program should be to teach students how to develop high-quality software. Far too many programmers have no idea how to write readable code, much less create a large, functional system with lots of moving parts. Programming is intrinsically difficult, but teaching students only the most arcane and complex parts of the programming discipline scares away many potentially great programmers.

According to Steve McConnell, author of Code Complete, the best programmers are not necessarily the most intelligent, but the most humble. Someone who understands his mental limitations will use every technique available to simplify his code, reducing its complexity and thereby increasing its quality. Complexity is probably the number-one enemy of software quality.

Pointers and recursion aren't intrinsic to programming

All the CS theory and most of the content on pointers and recursion will never be used by the average CS graduate. Spolsky even says so:

Now, I freely admit that programming with pointers is not needed in 90% of the code written today, and in fact, it's downright dangerous in production code. OK. That's fine. And functional programming is just not used much in practice. Agreed.

He then says that these concepts teach students the mental flexibility to view a problem at several levels of abstraction simultaneously. I think this type of "mental flexibility" might account for some of the bad code recent CS graduates write. A graduate's "mental flexibility" could tempt him to demonstrate his new CS skills by writing overly complex code that functions on multiple levels of abstraction. As I said above, intelligence doesn't correlate strongly with a programming success, but ego certainly correlates with failure.

Please don't misunderstand my point. I believe that some of the most difficult areas of programming are the most important (and interesting.) I look forward to learning about recursion and its power. I plan on taking plenty of CS theory classes, learning about even the most esoteric aspects of computer programming. However, I don't think every student would benefit from this type of information. Because these topics aren't necessary to write great applications, I don't think they should be necessary to graduate from a CS program.

This post may, in fact, be completely off-base and unsupported by the facts. However, I've decided to make this blog more personal by sharing more of my opinions and writing about things I care about. I have been worried about writing content that's relevant to my intended audience, but right now, I simply don't spend enough time writing code and playing with my computer to generate a suitable flow of relevant posts. I'm reclaiming this blog as a tool against my personal battle with obscurity.


Edit: I was sorely mistaken. This post is the misguided rant of a readability zealot. See my current position here.