Categories
Programming ruby

Beautiful code = proportionality, integrity and clarity?

Writing beautiful code is such an elusive subject. I’ve never been able to put into words what makes code great, it’s sort of these things that just is. I even read a book on it once, and while it had some quite tricks and hacks along the way, I never really thought I got closer to a definition of what beautiful code is.

I saw this talk about beautiful code yesterday. The talk is from a ruby conference and starts a little slow, but around 18 minutes in, it gets really interested. His main thesis of the talk is that beautiful code can be defined using only three measuring sticks: proportional – 200 lines to read a simple file (Hello C)?, integrity – does it actually do what it’s supposed to do and in a reasonable fashion (speed, memory usage etc.) and finally clarity – can you grok the code again quickly 2 years after you wrote it in the first place (Hello Perl). Each one of these must be balanced.

Can beautiful code really be captured by three such simple rules? Rules that individually seems to be far from beautiful, instead much more functional in nature.