Tuesday, 13 November 2012

The Spirituality of Computer Programming

About 18 years ago I had an unusual experience.  I found myself crying - albeit fairly briefly - over a few lines of a small computer program.  I am not referring though, to cries of frustration in response to a particularly badly written piece of code.  I can't remember what the code was now, or even whether it was mine or somebody else's.  I seem to remember (although I'm not certain) that it was written in a language called Lisp.

In the Christian circles that I've found myself involved with over the last few years, there has been a lot of talk about the "sacred/secular divide".  This has to do with the fact that - particularly in Evangelical churches but probably in other Christian traditions as well - some parts of life are often treated - explicitly or implicitly - as more "holy" or "spiritual" than others.

So for example, going to Church, reading the Bible, or working for churches, charities or missionary organisations is often considered more worthwhile or significant than cleaning your teeth, watching television, being a good primary school teacher, or - indeed - writing computer programs!

This seems to be a little at odds with the Bible itself.  For example, Psalm 24 verse 1:
The earth is the Lord's and everything in it, the world and all who live in it.
Or  Colossians 3 verses 23-24:
Whatever you do, work at it with all your heart, as working for the Lord, not for human masters, since you know that you will receive an inheritance from the Lord as a reward.
Or Philippians 4 verse 8:
Finally, brothers and sisters, whatever is true, whatever is noble, whatever is right, whatever is pure, whatever is lovely, whatever is admirable—if anything is excellent or praiseworthy—think about such things.
As well as being contradictory to the Bible, this artificial sacred/secular split also goes against common sense.   If God made the whole of the created order, including human beings with their skills, tastes and ingenuity, then it makes sense that the whole of life would be important to Him.  And if it's important to Him then it should also be important to me.

So - getting back to my original subject - what does God have to say about computer programming...?  I have to admit that the Bible is a little sketchy on this topic!  I'm not sure exactly why I got so tearful all those years ago over those few lines of computer code, but I was praying at the time and I did feel genuinely moved, and felt that God was moved by what I was seeing.

The best way I can think to make sense of this is that computing is a small but very significant part of mankind's technological development, and that technology was always part of God's intention for us.  It springs out of our God-given ingenuity, curiosity and creativity and is part of our call to rule over creation and fulfil it's potential.  It is up to us of course, whether we use these God-given skills wisely or not and ultimately, whether creation suffers or benefits from our stewardship.  God cares that we have these skills though, and He cares deeply about how we use and develop them, and what we do with them.

I have always felt passionate about computer programming - although I also feel slightly embarrassed to admit this "in print"!  I have a very logical mind, but I also have a fairly strong creative streak.  The existence of computers gives me a unique opportunity to combine these 2 things.  Because of computing, I can create something, purely out of logic, with no physical form, which nevertheless still somehow exists in a very precise and clearly defined way, is unique to me, and has an obvious and measurable impact on the real world!  Just a few decades ago, such a thing would have been completely unheard of.  I often feel as though I was born for such a time as this!

As well as having a practical use though, computer programs have something else that is common to anything we create, but which most non-programmers (and even some programmers) might be surprised by.  Computer programs have - or at least can have - beauty!  (the flip-side to this of course, is that they can be extremely ugly as well!).  I'm not just talking about the beauty of a well-designed web page or graphical user interface - although that's part of it of course - I'm talking about the code itself!

Computer code consists of logical solutions to problems.  But there are almost always a near infinite number of ways that any particular problem can be solved.  There are complicated ways and easy ways.  There are ugly ways - and yes, beautiful ways!  The word "beauty" isn't used that often by computer programmers when they talk about their code - instead the word "elegance" tends to be preferred instead.  An elegant piece of code is one that does what it's intended to do clearly, succinctly and efficiently and is - ideally - easy for others to understand and maintain.  But it has an aesthetic as well as a functional quality - it is pleasing to the developer, and to any other developer who sees it and has an eye for that sort of thing.

I have to admit that I sometimes struggle with the fact that I put so much effort into creating  beautiful things that are so rarely and seldom appreciated - or even understood!  Sure, users appreciate the outward form of my programs and are pleased with what they do (assuming I've done a good job) but hardly anyone fully appreciates what goes on underneath.  If I'm working as part of a team, which has a good quality control process in place, then parts of my code will be checked by other programmers occasionally to make sure I'm not doing anything stupid, but that's not quite the same thing.  Just occasionally I get to share my work with another programmer, who might be impressed by it, or a programmer who happens to read my code might appreciate what I've done and even mention it, but this is quite a rare thing.

It strikes me that a lot of creation itself seems to be like this.  Beauty is everywhere in all sorts of unexpected and inaccessible places and we continually seem to be discovering more of it.  It's almost like God didn't care that most of it would never be seen - although I'm sure He also delights in our continuing discovery of it.  It seems to me though, that God delights in beauty for its own sake - although, like my computer programs, most of it seems to have a functional purpose as well.  It's part of His creative nature, His joy, His exuberance.  He doesn't just create to perform a task, or for the sake of it.  Beauty, infuses everything He makes.
God saw all that he had made, and it was very good. And there was evening, and there was morning—the sixth day.     (Genesis 1 verse 31)


  1. Beauty in code... fantastic!

    I find tremendous satisfaction in realising I've written a procedure that dramatically saves processing time; solving a complex problem; or creating an... let me say it... elegant database design. Yes, these things are beautiful and good and they make the job worthwhile.

    There are very few people who ever see the detail of my code. It is interesting thinking about how many hidden facets of our world we'll never see but are still beautiful.

  2. Donald Knuth on Computer Programming as an Art - written in 1974!:


    He waffles on about the difference between art and science for ages, then starts talking more about programming about two fifths of the way down.

  3. May God hack such a system; and show its artificial intelligence for what it is worth.

  4. Sorry Mr. Mcgranor, but I'm not quite sure what you're getting at.

  5. I've always kinda thought God or atleast the entities in charge of creating the lower worlds are computer programmers, and we live in a large matrix computer simulation. Feels that way a lot of times

  6. nice post, thanks for sharing.

  7. God is the ideal Programmer who programmed everything that exists


If you don't have an account, and you want to leave your name, select "Name/URL" from the "Comment as" drop list below. Then just enter your name (you don't have to supply a URL) and click "Continue".