The required text for this course is Nick Montfort’s Exploratory Programming for the Arts and Humanities. We’re working with the second edition, published in 2021. You may not use the first edition, because it teaches an older version of the Python language. I suggest buying the text online. If because of shipping issues you cannot get access to the text in the first week or two, please let me know. Additional IPython notebooks and explanations are at https://github.com/HumanitiesDataAnalysis/code20
No class: Labor Day
What is code?
Classroom activity
Readings
Due Thu, Sep 16: Explore colab by making some letter point information and submit online. Worksheet online
Code criticism
Readings
agenda: Class agenda
Due Thu, Sep 23: Montfort Exercises 1 (Free project 3-1)
Fundamentals
Readings
task: Ongoing: do something in python that raises an error, and post the code and the error to the dedicated Slack channel. As we figure out Slack intricacies, too, if you get the same error type with a different message as someone else, post that as a reply to their comment, not as a whole new thread; and try to get your own type of error. Before class, you should submit at least one error.
agenda: Class agenda
Due Mon, Sep 27: Montfort Free Project 5-1.
Due Thu, Sep 30: Montfort Exercises 5-1 to 6-6, free project 6-1.
Reboot
Readings
Due Mon, Oct 04: Adopt an open-source project related to humanities research, cultural heritage, or another field of interest of yours. This will very likely be from the site github.com, but any online site that includes code files is acceptable. Before class on Slack, post a couple paragraphs on Slack about what you chose, including:
Note that you might not need to actually open any files yet–we’ll get to it later.
Due Thu, Oct 07: Exercises 7-1 to 7-6; free project 7-1 to 7-3. Note that 7.1 tries to get you running python on your own computer. This is a worthwhile endeavor, but if you find it’s not working, just post to the “Help Me” Slack channel and raise your issues in the next breakout section. Don’t lose sleep if it’s not straightforward–this is increasingly less important.
Back to strings
Readings
Due Mon, Oct 11: Describe a function from the project that you adopted–what does it do? Why did they write it? Does it call other functions? Link from Slack to the online portion of the code.
Due Thu, Oct 14: Montfort 8 (Exercises and Free project.)
Getting technical with strings
Readings
Resources
Due Thu, Oct 21: Montfort 9, exercises and free projects.
Some things Montfort doesn’t discuss, Part II.
description: Montfort’s text describes, fundamentally, a functional approach to programming–that’s why we’ve spent so much time talking about things like recursion, that you are unlikely to use. But an equally powerful model is object-oriented programming, in which the programmer defines reusable classes–things that bundle together information into themselves.
As you’ve seen looking over code online, the object-oriented method is very common in Python projects, especially large ones.
This week we’re taking a digression from the Montfort text to expose you to the basics of this method.
Readings
To follow up on some of the work manipulating strings, let’s try some some heavy duty stuff: Can Computers Create Meanings? A Cyber:Bio:Semiotic Perspective. N Katherine Hayles. Critical Inquiry, 2019.
This isn’t our normal textbook, so don’t feel like you need to understand everything. In particular, all the stuff involving methods starting with two underscores (“getitem”, etc.) are not things you need to understand. But you should understand the general idea of a class, including the key terms:
self
in a method definition.There’s some slightly more advanced stuff it is safe to ignore for now. * destructor * inheritance * child class
Due Mon, Oct 25: TBD: Working with strings.
Tutorial following
readings: Montfort 10-11 on images (Don’t invest too much time if you don’t care about images.)
agenda: Class agenda
Due Mon, Nov 01: Creating the DHSS Tweet parser/National Archives Parser/etc." Fill in some methods so that we move towards a bot that can actually do something.
Due Thu, Nov 04: Montfort Exercises for Chapter 10.
Polyglotland
Readings
Due Mon, Nov 08: After reading Hicks, choose a language from the following list, arranged roughly in order of how likely you are to encounter them in the digital humanities. Find some code online that uses it. You are not going to learn this language, but write a few paragraphs on Slack describing the language with some examples, either code or images. (Don’t worry about editing this too heavily, but do try to make it worth everyone’s time to read). How it is like or unlike Python as we’ve experienced it? As far as you can glean, why does this language exist? Can you find anything online that indicates what sort of people use it? Your choices are: [Javascript, R, Ruby, Java, C, Perl, Go, C++, Haskell, Lisp, Fortran.] Claim it on Slack so we all get a different one.
Due Thu, Nov 11: Custom exercises, Observable Notebooks.
Advanced Text
Readings
Working with APIs
readings: In class review of Organisciak and Capitanu, Text Mining in Python through the HTRC Feature Reader
Due Mon, Nov 22: Montfort 15, exercises. If you wish to work more heavily with images, let me know.
Web Browsing
Due Mon, Nov 29: Choose an API (or two) and get at least one item from it.
Due Mon, Nov 29: Find a website that looks like it might be scrapable for the assignment below.
Some important criteria:
Due Thu, Dec 02: Write a notebook to explore something in an API from online OR using Hathi Trust book count data OR the National Archives API.
It’s OK to include private user credentials in the notebook you submit to me, but you can also save and export it.
What you do may differ. You could try:
Images and beyond.
Due Wed, Dec 08: Write a python program that creates a list with at least 100 of something from the Internet. It can use either a scraper or an API. A few notes, here:
You must check the site’s ‘/robots.txt’ file to ensure that it’s permitted to download from this source.
Include in your loop the following piece of code that forces the loop to wait three seconds between requests; otherwise you may bomb the server.
import time
time.sleep(3)
Don’t do anything that requires sign-in/authentication.
TBD
Due Mon, Dec 13: Start building out a project that you could follow through on in the winter break. It doesn’t need to be done, but it should be clear– delete unused code.
{}
).Object Orientation wrapup
Concepts: