Blog Post

Learn to Code; Learn Code Culture

Yes, make 2012 your year of code. Learn to code. Not only is it a critical skill for DH folks, but coding should also be considered a basic literacy. I have been coding since I was 10 years old, when I learned BASIC (and its GOTOs) on my Commodore 64, one of the first popular home computers. I learned to code not because I had specific problems I wanted to solve; instead, coding was (and is) fun, a way of thinking, a way of making the computer do neat things, and an entry into a fascinating and rich culture.

 

To learn a foreign language, as we good humanists know, is more than learning syntax, grammar, and vocabulary. It is also to engage with a different culture that sees the world differently. I encourage digital humanists to keep the “humanist” part in mind when learning to code. Once you have learned the syntax, are able to get code to compile and run without errors (link to compiling post), and know most of the function names, you aren’t done. You certainly aren’t ready to tackle large projects. Code is a text, as the HASTAC Critical Code Studies forum shows so well. If we see coding as a merely a means to end, a necessary hurdle to clear before we can get to the “real” problems, then we do the craft of coding and ourselves a major disservice.

 

I like to think of computers, game consoles, smartphones, et al. as reading machines. The original text is just buried a little deeper and more disassociated from the process of meaning-production. This means that, when we're coding, we're creating a text, i.e., we're writing. Just as we would never assume that, because we know the grammar of a language, we’re ready to write a monograph in it, we should also recognize that coding has a panoply of methods, techniques, philosophies, and prior conversations and discoveries that we must research and understand before embarking on a significant code-writing project. We would never write a scholarly book without first reviewing the existing literature, right?

 

Along with the explicit philosophical and cultural aspects of coding—e.g., open source, geek culture, hacking, hacktivism, black hat vs. white hat, etc.—code itself is a form of writing with a dual audience: machines and other coders (including one’s future self). Others may want to read and modify that code in the future. Such a task becomes far more difficult when the code does not show an awareness of the culture. But beyond simply the practical issue of code maintenance, if you skip the culture, you're missing out on half the fun. Code culture has a long history of humor, stylistic and methodological debates, and cult-like devotion to a particular tool/language/platform/idea. One cultural touchstone of coding is a knowledge of the three virtues of programmers: laziness, impatience, and hubris. Without developing this trio of qualities, you will never be a Real Programmer.

 

Laziness is my favorite virtue and the one I think is most important to cultivate, especially when starting out. As I've written before and as Eric Steven Raymond says in “The Cathedral and the Bazaar” (another foundational text of code culture), no problem should ever be solved twice. Don’t try to build something that’s already been done. But this advice goes beyond the practical, teleological aspect of coding. Learn, too, about ways of coding: design patterns, unit testing, naming conventions, style. Discover existing code libraries and use them. If you don’t do these things, you’re like the tourist who visits a foreign country only able to order coffee and ask for directions to the bathroom. Or like the freshman who thinks the five paragraph essay will work for college writing. Worse, the code you write will be a brittle, incomprehensible mess, what’s bemoaned as “spaghetti code”. So, yes, learn to code, but learn the culture and best practices, too.

85

No comments