How I Learned Code
Historian or Computer Scientist?
Many exceptional programmers began writing code in their youth. Although I had some contact with code, I was much more of a hardware guy, building my own computers or tearing down old ones to figure out how they worked (or why they quit working). I first encountered HTML around the time I was in seventh grade, picking up the very basics simply out of a desire to learn how to build websites. My only other exposure to programming came in high school, when I took classes in BASIC and Visual Basic and continued learning about HTML, building sites in Dreamweaver that included little hobby projects and, eventually, a major overhaul of my dad’s business website.
History also always appealed to me, and in my senior year in high school I decided to study the subject. My original plan was to get a doctorate in history and apply my skills and knowledge to government service. This changed when I got to college and decided that being a professor would be a pretty nice gig. Computers, meanwhile, never factored into my education in college. I did not take a single computer science class while I was an undergrad at South Dakota State, instead focusing my efforts on history and economics. I remained interested in technology, following tech news blogs and Leo Laporte, but computers – and programming – never factored into my college studies.
I developed Framing Red Power, an analysis of mass media coverage of the Trail of Broken Treaties and that eventually became a digital component to my Master’s thesis. I also helped my colleagues in learning new skills in HTML and CSS. Out of the graduate seminar emerged several new, small-scale digital projects pursing original analysis and enlightening use of tools to illustrate new arguments about the past. My evangelism was set: at conferences I expounded on the benefits that digital scholarship provided for research, fumed at accusations that what we were doing was akin to Cliometrics (or worse, that what we were doing could just as easily be done with pencil and paper), and illustrated how digital humanities could completely change the way scholars do research. And I wrote code.
I continued learning more about CSS and began teaching myself the latest in web standards, HTML5. I taught myself the basics of XML and TEI encoding and began incorporating it into my digital scholarship. With a research assistantship during the fall and spring of 2008-2009, I worked on UNL’s Digital History project and was forced to learn PHP for a directory of digital scholars we were building (the project was derailed when hackers exploited a WordPress flaw and injected our development server with spam. The directory will soon be launched.)
There are two things I love about programming: one is the challenge, the pursuit of problem-solving; the other is the ability for programming to make my life easier.
PHP did just that. I began learning about modular web construction, the ability of PHP to make updating websites a simple matter of changing a single file. But I also enjoyed the challenge of writing good code and making code do what I wanted. Server-side scripting became an easy way to maintain websites, but I also learned how to interact with databases and picked up skills with MySQL. It was around this time that I also left the Windows operating system and began using Linux. I familiarized myself with the Unix filesystem, with the command line, with SSH, with vim. I’ve since adopted the MacBook Pro as my primary operating system, in large part because of OS X’s Unix backend (which led me, some time ago, to wonder how long before I leave behind the GUI for the command line).
How do I continue to learn? I simply dig in. Computers are best learned not though books or lecture, but by hands-on experience. My contact with computing and the humanities has also ignited a new research agenda that’s driving me into the history of computing and programming (more on this in a future blog post).
I learn and I write. I trace other’s code to see what each line of code does and how everything fits together. For the web, I use Firebug to debug or break down front-end development, in other cases I use Google (Parse Error: syntax error, unexpected $end? Google. NoMethodError? Google.)
Things brings us back to Steve Ramsay and the Ruby language. Why are so many of my colleagues unwilling to learn how to program? Naturally, part of the problem is time: some of my colleagues are a year or less away from finishing their dissertations, and out of necessity their energies are focused elsewhere. Others are perhaps unsure of how they would use it or, worse, fear programming altogether. Or maybe I’m just an ubergeek. Whatever the reason, programming offers a way of thinking differently about the work we do as humanists. I don’t see most historians becoming (as Bill Turkel would love) Programming Historians. But I would argue that digital humanists should at least be familiar with code, to understand its limitations and possibilities, in order to have better dialogue with the experts.
Other colleagues and instructors around me are not so sure. They would argue that programming is a skill best left to those who know it best, those who have studied the language(s) necessary for humanities computing, and that our energy better poured into our “traditional” scholarly roles of interpretation, argument, and evidence. I understand the point to his argument, and I don’t expect most humanists to be as geeky as I am. But I’m also beginning to wonder if digital humanists need to understand code more thoroughly. That perhaps understanding how and why something works is just as important as anything else we do with computers. Understanding code doesn’t just help us communicate with those that have studied it, but actually empower us to make good content for our audiences and users.
Becoming a good programmer means lots of practice and lots of failure. Don’t be discouraged, there is no other way: programming takes time. And it’s really hard. Dig into something you find interesting. In my case, it all started with wanting to know how websites worked. Perhaps you’re interested in how WordPress works, or curious about how Chromium functions.
Choose the right environment: you’re better off on a Mac or Linux because Cygwin on Windows is a painful experience.
- Learn Unix and how to navigate the filesystem
- Learn the basics of vim (and study up for the inevitable debate)
- Figure out how to use FTP and SSH
- Install your own blog, which will introduce you to PHP, MySQL, databases, Apache servers, and a whole lot more
- Take something you're interested in and build something for it. You might be interested in counting word frequencies for a body of text, for example. This can be done in several programming languages (here's my elementary Ruby code to achieve just that).
- Read programming blogs and sites like Reddit /r/programming and Hacker News
- Read How To Become A Hacker
- Read Why’s Poignant Guide to Ruby
- Read The Cathedral and the Bazaar
- Read Participating in the Bazaar
- Look at code from open source projects to learn how things work, then change something and see if it still works. If it does, understand why. If it doesn't, understand why.
- Use Firebug or Chrome's built-in developer tools to learn the language of the web
- Hang out with other smart programmers and coders. Don't be afraid to ask questions.
- Fill a bookshelf with technical reference books.