The beauty of software development

This is all about how amazing software development really is.

Taking "X" to be a geeky subject: The belief that "X" is truly a thing of beauty but scorned, unloved and misunderstood by the masses is by no means a modern concept. But it lingers on all the same. I suppose it's no coincidence that the culmination of many geeky subjects into a sort of geeky mega-subject (software development) might attract a bit more than it's fair share of abuse. People at least have some respect for mathematicians and physicists, even if they choose to distance themselves. Tell people you develop software for a living and they promptly fall asleep, or complain that their computer never works. Unless of course, you develop games for a living at which point you become every kid's best friend. (It's a strategy I highly recommend.)

Here's a few thoughts and some of my favourite quotes on the topic of beauty and software.

First up is Donald Knuth's, "Art of computer programming". For non-coders out there, this book is the equivalent of Steven Hawkings, "Brief History of Time", to most people: Everyone has heard of it. Many people own a copy. Some people have even attempted to read it but few have actually completed it and even less understood it. It's the kind of "compulsory reading" that most programmers skip but know they probably shouldn't have.

Knuth justifies his use of the word "Art" in the title:

Computer programming is an art, because it applies accumulated knowledge to the world, because it requires skill and ingenuity, and especially because it produces objects of beauty. A programmer who subconsciously views himself as an artist will enjoy what he does and will do it better.

You can almost hear a revolt starting.

Is coding Art? Well, I think there's one thing missing in Knuth's description that would make his assertion particularly convincing - Art can tell you something about humanity. Can your code do that? Well, I'm not sure. But, in the defense of code and the study of patterns in general, there are features and patterns of the world that are better reflected through them than Art. I think some of these patterns are surprisingly deep and beautiful - eigenvectors are the first to spring to mind. Certainly beautiful enough that I'd hang them on my wall if I could capture them in a picture.

You can express yourself through Art. Can you express yourself through code? Certainly. The most obvious example of this is the rapidly growing cross-over world of programming visual artists. Generative art is a topic all of it's own, so I'll just recommend anyone interested to check out Processing and follow links from there. I'm a fan of Robert Hodgin, especially this.

Is it possible to be defined by your creations, as many artists become defined by their output? This seems to be true of Justin Frankel, creator of several popular and sometimes controversial projects. There's a popular quote to go with his resignation from AOL to go with this, but please be aware I'm including it with some reservations as it's second hand and comes from a somewhat opinionated article. Just be aware it might be porky pies:

For me, coding is a form of self-expression. The company controls the most effective means of self-expression I have. This is unacceptable to me as an individual, therefore I must leave.

(I should probably also note his most recent project, REAPER, is absolutely fantastic and all you Cubase users should jump ship immediately.)

I might be nitpicking, but I suspect the most common understanding of 'beauty' in reference to code is actually something closer to 'elegance' rather than beauty as such. Code elegance is arguably the reading-between-the-lines topic of many software engineering mailing lists.

Some noteworth texts from the small to the large include a decent blog post, On Beauty in Code; a presentation on how to go about writing beautiful code (in PHP of all things!); and of course there's a rather interesting looking book, Beautiful Code. I haven't read this yet, but intend to shortly. The highlight for me is an interesting review of a review of the book entitled, Code isn't beautiful:

Ideas are beautiful. Algorithms are beautiful. Well executed ideas and algorithms are even more beautiful. But the code itself is not beautiful. The beauty of code lies in the architecture, the ideas, the grander algorithms and strategies that code represents.

I think that's pretty much on the button.

If your code was a building - an analogy that happens to be a good fit a lot of the time - you could marvel at it's architecture. You could be impressed by the construction, or the balance of functionality and aesthetics. And like appreciation of architecture, a lot can be in the eye of the beholder!

Coventry's Belgade Theatre.

Is it a "bold and dynamic" statement, developed through a "sculpural process" where "the spaces that it embraces, and that it implies around itself, are as important as the form itself"? Or, an unimaginative concrete cube ungracefully slapped into the middle of an already concrete-heavy town, representing little but the staggering lack of inspiration present in its creators? You decide! Comparisons with your most loved or love-to-hate software engineering projects as comments please.

Ignoring the code and algorithms for a moment, it's undeniable that the output of code can be beautiful - after all it's a major goal of computer graphics research. And not all of it involves artists in the traditional sense. Data visualisation has become a big topic in recent years. I find the growth of this area quite fascinating as it produces attractive, often intriguing images but apparently skipping over the role of an artist in a traditional sense and deriving input purely from real world data. It's arguably an expression of humanity - although not quite in the same sense I originally had in mind!

On a personal note, I still remember the first implementation of our radiosity algorithm emerge. The whole thing happened quite quickly and we lost several days to just playing with it: tweaking the scene, changing the lights, adding some post processing. It was something none of us had seen before, and it took us quite by surprise. I'd had that feel-good effect from previous projects, but there's something about actually being able to see the result and play with it that makes it all the more tangible.

I clearly remember my tutor at university complaining that too many people focus on process over product. In fact, he was my music tutor complaining about composers, but the point applies very well to software engineering. But that's not to say there isn't beauty - even joy - to gain from the creation of code. This leads me to my last, but perhaps favourite quote of all time. Here's Alexander Stepanov (author of the C++ standard library) and Mat Marcus in some lecture notes:

Programming has become a disreputable, lowly activity. More and more programmers try to become managers, product managers, architects, evangelists – anything but writing code. It is possible now to find a professor of Computer Science who never wrote a program. And it is almost impossible to find a professor who actually writes code that is used by anyone: the task of writing code is delegated to graduate students. Programming is wonderful. The best job in the world is to be a computer programmer. Code can be as beautiful as the periodic table or Bach’s Well Tempered Clavier.

It's one of my favourite quotes because it's so passionate: I too love programming! I love patterns and algorithms! The world is fantastic!

But - and it's a big but - that quote simulateously shines light on the big elephant in the room: Software development is programming but with people. That 'people' part is vitally important, and is occasionally neglected by programmers of code, beautiful or otherwise. It mustn't be. Coding is empowering, but the power still lies with people. I suspect software development does have a thing or two to tell us about humanity.

And that's why software development really is amazing. Even if it's simultaneous one of the most mind-numbingly difficult, painful and exhilarating things I can think of.

6 thoughts on “The beauty of software development

  1. Ashutosh Mehra

    You put in most beautiful words what I too feel about software development ("programming in groups").

    However, there is one thing that totally spoils, at least for me, the joy of programming: The API problem -- Bugs and other deviant behaviors of third-party API and libraries. Platform APIs, 3rd Party Library APIs -- all have bugs. Once we hit these, there's only so much we can do -- put workarounds on top of workarounds. We can fix bugs in our own code, and even learn a few things in the process and feel good about it when its done. But when we are literally working "against" a library/platform, it just sucks the programming juices. It is difficult to feel any kind of joy then, and the elegance disappears. The more complex and ambitious programs that we try to write, the more we must build upon the work of others, the more we hit into this problem.

    Also, in connection with this post, two relevant essays the readers might find interesting are Knuth's Turing Award Lecture Computer programming as an art and Andrei Ershov's essay Aesthetics and the human factor in programming.

  2. Sam Martin Post author

    Thanks Ashutosh! You make a very good point.

    I suspect the API problem is not unique to software development. Large scale (physical) engineering has similar issues. In fact they have a worse one - previously working components can deteriorate and fail over time. Apart from cosmic rays and hardware ageing around it, software is largely immune from this.

    Perhaps it is the close coupling of sofware components that is our downfall at the moment. Maybe we need more redundancy, or more flexible abstractions?

    I hadn't read Andrei Ershov's lecture before - it's a good recommendation. He has an interesting point about programming resisting assembly line construction. This seems to be true of any creative process I've ever witnessed.

    I'm not sure how well it bodes for the future though. I think large scale collaborations have value in there own right, and software engineering is tricky to scale up.

  3. dysfunctor

    Have you come across the notion of Software Craftsmanship?

    "Craft" is used in the mediaeval sense; a term that includes portrait painting, bridge building, instrument making, baking and so on. You can choose your metaphor (art, science, engineering, architecture, recipes) to suit your needs.

    The Software Craftsmanship movement also espouses the three stages of competence used by the mediaeval guilds:

    Apprentice (can get useful things done; has limits)
    Journeyman (has the core skills needed on any normal project)
    Master (understands the limits of his craft; ready to push the boundaries)

    I'm not sure how practical it is to apply these static categories in such a dynamic field, but it has to be better than scribbling "_x_ years of experience in _y_" on your CV.

    By the way, if you haven't got it yet, I have a copy of Beautiful Code you can borrow. The main thing I got from the book is that beauty is in the eye of the beholder. Code is beautiful when it solves a problem and makes you say, "Wow! I didn't know that was possible." In other words, it is contingent on the problems you have and repertoire of solutions you've tried. The first time I saw a binary tree I thought it was beautiful.

  4. Sam Martin

    No, I hadn't see that before! I shall add Master C++ Software Craftsman, and Haskell Apprentice to my CV now 🙂

    And thanks, I would like to take a look at Beautiful Code at some point if that's ok! I'd need to clear some space from my desk first though. I have a more-ridiculous-than-usual pile of backed up reading material to get through first.

  5. Uncompetative

    "Is coding Art? Well, I think there’s one thing missing in Knuth’s description that would make his assertion particularly convincing – Art can tell you something about humanity. Can your code do that? Well, I’m not sure."

    Knuth is wrong and should stick to what he is good at.

    You are right to raise doubts. He should have called his book:

    'The Craft of Computer Programming'

    Using the word 'Art' with a capital 'A' is incredibly pretentious and philosophically unjustifiable. He could have gotten away with calling it:

    'The aesthetics of Computer Programming'

    Using the word 'aesthetics' with a small 'a', but I feel that 'Craft' is better. After all there are many masterpieces in furniture. Code beauty is also a reasonable phrase to use - one that may be less obscure than 'aesthetics' (which actually imply a set of informal rules that may help you achieve beauty and harmony).

    Having done a degree in Fine Art which involved writing philosophical essays on all of these topics for the Art History component of the course after which I became a programmer, working on UX and a functional end-user programming language, I can confidently assert that writing software has nothing to do with Art, but that the lessons of aesthetics (harmony, symmetry, coherence, concision, appropriate use of emphasis and the suppression of unimportant details) apply very well to code.

  6. Greg Wilson

    I admit I'm biased (I started the "Beautiful Code" book project, and was one of its editors), but to say "...code itself is not beautiful. The beauty of code lies in the architecture, the ideas, the grander algorithms and strategies that code represents." is kind of like saying that blueprints can be beautiful, but buildings cannot. The belief that code is "merely" an implementation of an algorithm is a common category error in academia, but few people who have actually built large software systems would agree with it---Donald Knuth certainly doesn't.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.