On Writing Code

Coding in C++ is like a knife fight. The compiler is your first enemy, and the system you're writing is the second. With each line of code, you use every underhanded trick you can think of to gain advantage. And if you mess up, the compiler stabs you with incomprehensible errors and mysterious warnings. Should you survive them, your system viciously attacks you with segmentation faults, and then, only after you have defeated those, do you get to battle the actual correctness bugs.

"Bugs" is an understatement. A better image is ugly, man-eating insectoids roughly the size of SUVs, each surrounded by a horde of smaller beasties that aid and assist it, and you equipped with your measely fighting knife. While I must admit that debuggers, lint tools, and other things C coders will point to in their defense add some more weapons to your arsenal, the fundamental metaphor remains intact.

Coding in Java is like walking. You move along, slowly, methodically, irrevocably making progress toward your goal. It takes time, and you must occasionally walk around strange language idioms and syntax requirements, but it is not actually dangerous. Nothing is trying to kill you with segmentation faults, and you will, inevitably, reach your destination. And sometimes, depending on where you are going, you may even have time to contemplate some pretty sights along the way.

Coding in Perl is like dancing Argentine Tango. There is a learning curve of no little steepness, but once you've started using Perl you can hardly stop. Programming becomes almost a carnal pleasure. You find yourself writing scripts to do things that you would have unthinkingly done by hand only a couple years ago. And you find that those scripts are really elegant, in their own, Perlish way, and yet each is new and unique, in each you take a different twist on a standard move, that works better in that context.

On the other hand, Perl code is as ephemeral as a dance. If you try to extend it too far, fatigue overcomes you, and once you finish a dance, you can never again recapture its spirit. Trying to understand Perl that is already written is as fruitful as trying to recreate a dance from the dancers' footprints.

Coding in Scheme is like playing Mozart. Even the apprentice can begin, and the results will be recognizable. But when you get reasonably good at it, you sit down, and code flows from your mind in beautiful waves that seem hardly to pass through your fingers at all --- you think, and your thoughts take form. Each program must be approached with careful study and forethought, but when you actually write it, the process is a brilliant, ravishing experience. And no matter how good you are, you always have the feeling that if you were smarter, you would be better. Always, some clever new way of structuring your programs is just beyond your grasp.

Coding in Ruby is like coding in Scheme. Yet somehow both more and less. Less otherworldly, more down-to-earth. Ruby code may not be Mozart, but it is still music. Yet at the same time, it is more comfortable than Scheme: the I/O is nicer, the foreign language bindings are easier, the libraries are more practical (albeit less intellectual). After only a short courtship, Ruby had become my language of choice.

A short courtship, however, proved to presage a short romance. It took only a year or so of coding in Ruby for me to see that the things I liked about the design of the language itself (as opposed to, say, its libraries) I liked for their resemblance to Scheme; and the things I disliked I disliked because Scheme had shown me a better way. So now my heart is filled with yearning: to live forever in the elegance and simplicity of Scheme, and yet have the volume and quality of support, libraries and tools that have been built for other tongues.