Programming Literature

Or the oddest thing I came up with so far

Pablo de Haro
Towards Data Science

--

There is an idea that has been circling around in my mind for a while. A rather silly one, but still, one that I want to try and test.

It all started some time ago with some news on my country, Argentina. The Government and a foundation called Fundación Sadosky were announcing a new program called Program.ar. This was presented as a plan to start working towards the goal of teaching programming to every kid in our country through the schools.

This idea (that every kid should learn to program) wasn’t new or original, as some of the most famous and powerful “nerds” in the world had already proposed it, and even had been working a bit on that. But I was a little surprised to see it put into action so close to me and so quickly. I started thinking a lot in the implications of such movement.

To me, programming is somewhere in the middle between literacy and maths. It is of course something very precise and mathematical, something that can be analyzed, and that requires and excercises rational and abstract thinking. But to program you also need to learn languages. And you need to learn how to express yourself in them, in a way that both the machines and the human beings can understand your code. We even go beyond that, and we value the expresiveness of a piece of code. We value its beauty, its simplicity, its conciseness and its cleanliness.

My code is poetry, and it compiles. Suck it Neruda!

Most of the code we write is to make things work. We put some effort into making it beautiful, a lot into making it maintainable, but most of it goes into making it work. And that is OK. That is what we are being paid to do.

Going back to Program.ar, and its implications, I started to imagine some what if scenarios. If we consider that programming could mean to society a change similar to literacy, or basic math, then a whole new world seems to open up before us. And I’m not thinking in the industry, or science. I’m thinking about culture. Literacy and math allowed for some new forms of expression and entertainment to arise, qualitatively different from those that already existed. More sophisticated and, in some cases, more perdurable.

What if programming had the same effect? What if much of the activities that only a programmer can do became a new form of expression and/or entertainment?

I started imagining a world, much like ours, but with programming having been around for maybe thousands of years. I’m even planning on writing a novel with that premise. Normal people would program their alarms with source code. They would write programming scripts to make office work. They would do their crosslines (the programming version of crosswords) on their newspapers. But one thing they would do got me thinking beyond. They would read literature, written in source code. They would appreciate the same things we value in our code as “beauty”, and write code that doesn’t have to work or be maintainable, but only beautiful. Or at least, I think they would.

I liked this last idea. I thought it was something that could be nice to see. So I had to put it in practice.

Now, to be honest, nothing impressive has come up of this yet. But I managed to write a little story in groovy. It compiles. And I like how it looks. It doesn’t do anything, as you may expect, but it is meant to be read by human beings, and nothing else. You can find it in the following gist:

Hopefully, you have read it. You probably didn’t find it fascinating, or even good. But I bet you could follow the story. If you did, then this proof of concept was successful.

I can hear you saying… “is that all?”

Well, not exactly, but for now it will be. I have more than a couple of ideas to take this a little further, like making a story in an statically typed language (and making it compile, of course), and even visiting some other programming paradigms (logic paradigm in particular seems to have potential), but I would like to develop them further before publishing anything.

So yeah, this is one of the silliest ideas that I’ve had in my life. But I love it. I hope you like it too.

And maybe, just maybe, if you liked it very much, you may try to write your own work of literature in your favorite programming language. If you do, please share it!

Update: Following up this article, Continuity is Recursive

--

--

Responses (3)