Daily Archives: 6/14/2007

Cuckoo Hashing, Theory and Practice

In an effort to try to continue to claim that I know something about computer science, I’ve been trying to find some good blogs in computer science and mathematics, and see what people who don’t spend all their time making pixels turn the right color do. The My Biased Coin blog has an interesting introduction to cuckoo hashing, which until this morning, was a term I had never heard before. It seems like a very good idea, with good (and somewhat surprising) theoretical bounds on performance.

My Biased Coin: Cuckoo Hashing, Theory and Practice : Part 1

Technorati Tags: ,

QOTD: Was teaching kids BASIC as a first programming language really fatal?

Dijkstra once famously claimed (well, perhaps not anymore, since fewer and fewer learn BASIC):

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

The question that I asked myself last night: “Was Dijkstra right?”

I must admit, I’m one of those guys who learned BASIC as a kid, and then later went on to study computer science, get a couple of degrees, and proceed to make a pretty decent living writing what I hope are good programs. Am I just “practically impossible”? The exception that proves the rule? Or was something else at work here.

I’ll submit that Dijkstra was wrong (although I’m going to provide nothing more than simple gesticulation to back this idea up). It is certainly true that the vast majority of people who picked up BASIC as a first language never progressed beyond being anything but the most dreadful programmers. I suspect, however, that is true about almost any skill. I never became good at roller skating. I don’t possess anything but the most rudimentary skills at drawing. My ability to play the piano is limited to halting walks up and down the keyboard in tuneless exercises.

Peter Norvig has an essay about learning to program which I think hints at the fallacy in Dijkstra’s famous claim. It takes a long time to learn to program, and you have to start somewhere. You learn to program by doing, and for a short generation of programmers, the most accessible entry point was through the BASIC interpreter that came on their Apple II, their Atari or their Commodore 64. A kid with no understanding of programming could noodle around, flailing miserably, writing silly and bad programs, and most importantly figure out that he liked doing it. He could begin to read other people’s programs, and improve. He could even ultimately graduate beyond the world of BASIC, and move on to different ideas.

Dijkstra was in some sense right, but missed the forest for the trees. To get kids to learn programming, you have to get them programming. I pity the poor kid who tries to learn C or uses Visual C# as a first language. Today, languages like Python or even Perl and PHP would take the place of BASIC, and by virtue of their more powerful datatypes and structuring, generally are better choices for the beginning programmer. Yes, we see lots of really bad code written in all these languages. But from the din of mediocre achievement (itself not totally without value) a few scattered diamonds will form.

What’s your take? Was BASIC your first language? Did you turn out to be an okay programmer?

Technorati Tags: , ,

Addendum: Interesting notes on the acquisition of expertise.