Creative Coding

August 05, 2006 at 10:32 PM | categories: python, oldblog | View Comments

I've now got a focus for this blog - creative coding. This is a consequence of spending a week at OSCON, talking to lots of people, making a few commitments for a variety of people, and trip to a bookstore and deciding to buy The Complete Idiot's Guide to Creative Writing, and also Kathy Sierra's keynote talk, where she said "think of something you're passionate about that isn't code". Well, actually there is something I'm passionate about, that is creative, fun, and artistic, and I'm sorry, it's coding. For me coding is creative, and something to be passionate about. This viewpoint firmed itself up somewhere halfway back to the UK, and I decided that that is what this blog should be about.

Music is great, I love listening to it, but I have no flair there, no creativty. Poetry is intriguing, but it took me 32 years to understand what the point of poetry is. Ask a writer why he writes, and many will reply - because they have to. All are creative in their own ways. All entertain in their own ways. For me coding is just as exciting, creative and fun. It's why programmers argue about language - all major language (bar a few) are turing complete meaning they're all equivalent. Python is no more powerful than Perl. Perl is no more powerful than Ruby. Ruby is no more powerful than C and so on.

So how to they differ? The term we often use is expressiveness. But in reality, what we really mean is they are aesthetically different.

There being only one obvious way to do it means that when we meet new code, we can see the algorithm in use immediately, since all the common forms disappear from our view leaving the structure behind. This is valued implicitly when access to code is important, and an ability to understand quickly is important. It's one reason people create style guides and cookbooks and patterns where these things are valued. However in a language like this, the code poets still exist, they invent forms that make the language more powerful, so that more can be said in a perhaps familiar way, but with the least number of lines. In a way, python can be viewed as being the language of the Haiku - strict rules, powerful, and evocative.

There being many ways to do it is important where the need for personal expression, the need to do it my way is viewed as important. It's of little suprise then that this viewpoint, that a language that is inclusive of the need to express a personal coding style also furnishes some of the more intriquing concepts. How obfuscated can we make this code? How can we write poetry in this code (Two completely opposite goals in many respects). In this way, perl is spectacular - it allows the writer to mould the way something is said to match the needs of the conversation. If you need to say it in morse code, you can. If you want to say it in Buffy, you can. If haiku is your thing you can do that too, and if the computer equivalent of thrash music is your thing, you can do that too.

I'm going to refrain on making allegories on other languages, though I would find it fun to hear quite why so many people find the concept that Ruby is poignent compelling. To me Ruby is the friend I want to meet and get to know, but simply haven't has a chance to find something fun to do with in order to really understand.

However at the end of the day, the real differences here whilst we label them expressiveness are really aesthetic. I would also contend that anyone can learn to code. At present my favourite language is python for many reasons, and so the focus of this blog will be largely on creative coding in python. However, just as the Haiki, or Short Story or Novel, Novella, Limerick etc are all no better than each other, I feel the same about languages. They're all fun. (with the possible exception of COBOL - she needs to loosen up and go out and get a life :-)

So, why the blog, why this focus? After the Google summer of code BoF, I and a few others were kindly taken by Google to downtown Portland for a beer and some Pizza. The conversation strayed over to learning python, and in repy to a comment about "how long do you think it would take to learn python from scratch" (ie no coding experience), one of the summer of code students said "about 2-3 months". I replied "no, a week, maybe 2 at least". This took him aback, challenging me with "have you ever taught programming to complete novices", and ironically, I have. Whilst I was working for Manchester University many moons ago,  I gave an introductory programming course. So I mentioned that.

The conversation then drifted onto the idea of writing adventure games - the old "choose your own adventure game" style game in python as a learning example, and I offered to write a series of exercises which would teach someone python and programming from scratch. Why did I do this? Madness? Possibly. However, it's probably the same reason Laurie Rozakis wrote a book on how to write creatively - it's fun writing code.

So that's it in a nutshell really, someone challenging me to forget the thing I find fun and creative when thinking about what I find fun, finding a book about creative writing, and me realising that I've not actually seen a site dedicate to the fun of the act of creating code, and actually having a project I've promised to do. Hopefully the writing will be as much fun as writing code :-)

More to come soon :-)
blog comments powered by Disqus