[Humanist] 23.92 programming for poets

Humanist Discussion Group willard.mccarty at mccarty.org.uk
Fri Jun 19 08:49:25 CEST 2009

                  Humanist Discussion Group, Vol. 23, No. 92.
         Centre for Computing in the Humanities, King's College London
                Submit to: humanist at lists.digitalhumanities.org

        Date: Thu, 18 Jun 2009 07:15:08 +0100
        From: Harvey Quamen <hquamen at ualberta.ca>
        Subject: programming for digital humanists

Hi all:

I'm glad to hear that others have been thinking about ways to get  
humanities students to program more. I've been teaching such a course  
for the University of Alberta's Humanities Computing program for the  
last few years and am happy to share some ideas. Hope these can  
generate some good conversation. (Feel free to reply on- or off-list,  
but I'm on the road right now, so may be a bit slow in reply....)

My course focuses on web delivery technologies -- specifically, a  
MySQL database with some kind of HTML + CSS front end. I use PHP as a  
scripting language, only because it's so readily available on various  
host servers. I like how PHP accommodates both old-style "procedural"  
programming as well as object-oriented coding. It's a language that  
accommodates the students as they grow. I'm more or less language- 
agnostic (and am leaning increasingly towards Ruby), although I used  
to teach Perl, but didn't really like the "line noise" it generates.  
Students have a hard time reading it.

Students these days feel quite at home on the web, of course, and have  
some curiosity about how it works. Consequently, I find that web  
scripting is an easier sell than, say, text analysis or algorithms.  
The other popular draw is game design, and our computer science  
department offers such a course (open to non-computer-science majors,  

I've eliminated almost all math from my web scripting course. Right  
away, I show the students examples of HTML and XML and convince them  
that computers today are all about texts, not numbers. (I often cite  
Danny Hillis's claim at the end of "The Pattern on the Stone" that --  
bad paraphrase follows -- "if the original computer scientists labeled  
the two states X and Y, we'd say that computers do everything with  
texts, not numbers.") Consequently, about 90% of the built-in PHP  
functions I teach my students are string functions. I tell my students  
that they'll soon be able to "slice and dice" texts with ease, and  
that that skill will be foundational for the digital humanist scholar  
of the next few decades.  For students who have "math phobia," this is  
welcome news.

We spend a few beginning weeks on HTML + CSS (with some XML thrown in,  
depending on the audience and time), followed by about three weeks on  
MySQL (learning just enough SQL to squeak through) and then spend the  
remainder of the semester on PHP. We meet in a lab, so every student  
has a computer. Typically, I'll give a lecture explaining the  
concepts, then we'll do an in-class work-along exercise or two, and  
then I'll send them off with some homework. They have a weekly script  
to write, plus they have to do a certain number of "5-Minute  
Exercises" (10 for an "A," 8 for a "B," etc.) which emphasize the  
concepts they've been learning -- simple things like printing an array  
as an HTML table, or reading from a file or even doing a very simple  
web scrape. (Some are online but most are in a course packet.)

My favourite exercise -- and one that gets them over the introductory  
hump, so to speak -- is checking to see if a set of strings are  
palindromes or not. Cruelly, I don't clue them in to some of the  
functions that would make that easier, so they solve it on their own  
and even start comparing their various algorithms' efficiency, though  
they don't quite have the vocabulary to do it.

In the end, each student produces a message board to which visitors  
may post and read previous postings. Each student needs to add one  
self-chosen "special feature" to his or her board -- maybe having a  
membership login or allowing certain HTML in postings (via either a  
whitelist or a blacklist), or offering up different skins depending on  
user preference, etc. The scripting makes sense to them in this  
context as a problem-solving step, or as the "glue" that holds the web  
interface to the database. And since there isn't just one script, the  
students don't think in terms of a "killer app" but rather in a series  
of small, concrete, solvable scripting problems.

It's been difficult to find a good textbook and even PHP + MySQL books  
are typically not pitched correctly for my students.  Fortunately,  
O'Reilly has a great series for beginners called "Head First." I  
recently served as a technical editor for the "Head First PHP & MySQL"  
book and it has some terrific material in it, including chapters on  
some sophisticated stuff like regular expressions and programming to  
the YouTube API.  It'll likely serve here on out as the textbook for  
my class. Have no fear -- I get no royalties from it ... :-(

One year a few students banded together and we did a second semester  
of more advanced topics as an independent study. There, I covered some  
object-oriented concepts and we wrote some web scrapers.

I have some online materials from the last course offering at <http://www.huco.ualberta.ca/~hquamen/resources/ 

I'd be quite happy to help start collecting some resources -- even  
putting together an online wiki or something so we can share ideas.   
I'm on the road for another 10 days, though, so have no fear if I  
reply slowly.

-- Harvey Quamen
Humanities Computing
University of Alberta

More information about the Humanist mailing list