Wednesday, January 04, 2006

Building blocks of software

I was interested to see Joel Spolsky's complaints about Java programmers, because I must admit I've been thinking along the same lines for a while now.

Just recently I sat down and implemented a cross-thread garbage collection routine from scratch. It's hideously complicated and it took me a week to write, but it more or less worked as intended first time out. Why did I write something as basic as a garbage collection routine? Wasn't I using a high level language that did that? Sure I was, I was writing in Perl which, amongst other things, I think has a better garbage collection model than Java. But when things get really complicated, especially when you're dealing with multiple stacks of hashes with circular references which can be modified asynchronous by multiple threads, standard garbage collection techniques more or less give up. So I had to write my own, and when it was done I started to wonder how many modern programmers with their model driven architectures could have done likewise. If I hadn't understood the underlying garbage collection model of the language I using, would I have been able to write my own? If I hadn't understood the garbage collection model would I have even been able understand what was wrong with my code?

The three hardest things to understand about programming are recursion, threading and pointers, and most of the people claiming to understand the last two really don't. Most people doing threaded code are writing cargo cult programs, they don't really understand what's going on, especially when dealing with sockets, because the next two hardest things to understand are probably functional programming, and sockets. Most people who think they understand sockets also don't...

The garbage collection routine I was writing dealt with all of those things, but this isn't a rant about how I'm smart and everyone else is dumb, although it looks a lot like one. It's a rant about people being given substandard training and then being told that they're a programmer, when really haven't been properly equipped with the tools they'll need to approach the hard problems.

Dion Almaer posted a robust response to Joel's complaints, but I'm not convinced he really got Joel's point.
It drove me nuts that my CSci program taught me how to write my own database from scratch, but didn't teach me how to use Oracle well. -- Dion Almaer
The point of a degree is to teach you to think, it isn't supposed to teach you how to use specific applications. After all how can you claim to understand how an database works if all you've been taught is how to use Oracle. Hands up if you've ever written in assembler? If not, do you really understand how the compiler optimises your code? Don't you think you should?

There isn't anything wrong with Java, I don't think either Joel or myself are trying to say that Java is a poor language, and I think he's prejudicing his case by being deliberately controversial and singling out Java.
I want to develop with developers who can deliver business applications to our users. -- Dion Almaer
The point of a degree is to give you the tools you need to approach life. So the point of a Computer Science degree shouldn't be to teach you how to use Oracle, or how to deliver business applications, it shouldn't even be teaching you to program. The point is to teach you how to learn to program.

No comments:

Post a Comment