Elegant code

A class of old habits

The elegance of coding is a topic that popped up regularly in the conversations between the participants of this lab. Graham Harwood inspired me to think a bit more about coding in general. This phrase on Wikipedia seems to summarize well what elegant code should be:

… a computer program or algorithm is elegant if it uses a small amount of intuitive code to great effect.

I do not consider myself as a pure coder, but I might begin to understand why I am so attracted by the act of coding. There is simply something beautiful about an elegant piece of working code.

During this week I managed to spend some time with Processing. Not much, but still I rewrote some old Actionscript to function in Processing and turned it into an ‘elegant’ class. Then I browsed the available ‘Getting started with Processing‘ examples and in a very basic way plugged in my class. Here is a result of these ‘messing around sessions’:

Processing exercise

Obviously it resembles my previous work in Actionscript since I simple reused my old code. But I have it now in an elegant reusable class. The very traditional wish for visual beauty in art is matched by a very similar ‘feel’ of beauty in writing code.

It think I still need these kinds of visual outputs just to show or communicate to people what I sense while writing ‘elegant’ code.

Leave a comment