16 AUGUST 2006
It may surprise you that the word “elegant” often crops up amongst programmers when discussing software.
“Elegant” is used to describe a clear, simple and well-formed programming
solution. It may be hard for some to understand but programming can be a
joy. I often think about it as swimming effortlessly and expertly through deep
clear blue water – each move and turn is a corresponding nifty solution.
I’m currently working on a web site that involves PHP programming. I’m
new to PHP and I quickly grew to like the language once I started programming in it.
It allows for elegant code.
When I was at university, I remember reading a paper on gender differences in programming. It said that women write wordier, more readable code whereas men write relatively more obscure code. Given there’s been competition for over 20 years to write the most obscure C code, I can believe it.
Here’s a selection of winning entries from the 2004 The International Obfuscated C Code Contest [www.de.ioccc.org].
This application graphs polynomials on a standard Cartesian coordinate
system. Polynomials of the form ax^0 + bx^1 + cx^2 + … are graphed by
passing the coefficients a, b, c, etc. as double precision arguments.
It allows up to 8 parameters (thus up to x^7).
However, people also format their source code in ourstanding ways.
Rinia is a tool for embedding CRCs in text files.
CRC = Cyclical Redundancy Checking, an error checking technique used to ensure the accuracy of transmitting digital data.
A different kind of elegance but impressive nonetheless.