On Learning to Code

05 Jan 2014

As part of a course in the digital humanities that I took last semester, I learned the basics of Python and completed a project using the programming language to analyze metrical patterns in Shakespeare’s sonnets. As the popularity of the digital humanities and literary informatics grows, my experience is becoming less and less unique. More people like me, who have a background in the humanities and thought they left math and science far behind, are trying their hands at coding for the first time.

There’s a growing record of experiences from these first-time coders. The recent New York Times piece The Code of Life is one such account. The book critic Juliet Waters writes of how she spent a year taking the online programming course from Codecademy and how this experience was commensurate with her career as a writer. I was already planning to write about my own three-month journey in coding when this article was published, and I was happy to see that someone else had a positive experience learning to code. But there was something that troubled me about Waters’ account of coding. She writes:

Yes, programming is challenging, frustrating and often tedious. But it offers satisfactions that are not unlike those of writing. The elegant loops of logic, the attention to detail, the mission of getting the maximum amount of impact from the fewest possible lines, the feeling of making something engaging from a few wispy, abstract ideas — these challenges were familiar to me as a critic. By my third month, I had internalized a new logic, a different way of looking at information.

My own feelings on learning to program are a bit different. The challenges, frustrations, and pleasures of coding come, for me, out of the fact that computer programming is so different from writing. I, too, “internalized a new logic,” but the newness came from reaching outside of my discipline.

I enjoyed math in high school and the early years of college, before I became an English major and literature grad student. Python exercised that mathematical part of my brain, which has been dormant for quite a while. The different kind of logical thinking that programming required of me was a welcome respite from the usual lines of thought employed in my day-to-day as a lit student. The logic of programming is mathematical, requiring the creative element of code to follow strict rules, which when not followed cause a program to break. By contrast, writing allows for the frequent breaking of rules, and in fact much of the creativity of writing can come from breaking a rule for emphasis. There are no error messages when writing essays, and editing and debugging are very different activities. As good interdisciplinary work should, programming got me thinking differently about my critical work and opened up new possibilities for inquiry. Code and critical prose are equipped to explore different literary questions, and for me the magic happened when programming and writing were used together to tackle a problem from different angles.

My experience was perhaps not as transformative as Waters’s, who writes about discovering a world of technology of which she was not previously aware. I already had a working knowledge of services like GitHub and of the ethical discussions in the tech world at large and within the digital humanities. But I’m excited about the ability that this introduction to programming has given me to now effectively communicate with more experienced programmers.

For me this three-month introduction to Python is the beginning of what I hope will be a sustained engagement with the literary application of digital tools. While I recognize that there’s still a long way to go, I welcome the opportunity to think mathematically from time to time, and to venture outside of my disciplinary corner in the pursuit of fruitful critical questions.