nickm.com > classes > exploratory programming, spring 2018

CMS 844 . Exploratory Programming for the Arts and Humanities

Draft/tentative syllabus for the MIT course offering in Spring 2018 — Updated December 10, 2017, sure to change!

Instructor: Nick Montfort

Room: 1-242

Office Hours: 14N-233, Wednesdays 10:30am-11:30am & by appointment

Course Description

Exploratory Programming textbook cover

This course is about how to think with computation, how computation and media interact, and how we can understand computation as a part of culture. Programming is introduced as a way to iteratively design both artworks and humanities projects, in a process that allows the programmer to discover the direction of the project during programming. The idea of exploratory programming differs from the instrumental programming done to create an an app or a banking system in compliance with a pre-determined specification. No previous background in programming is required.

The course mainly consists of in-class programming exercises of various sorts. These include following along and inputting code, doing exercises of a more traditional sort, and, importantly, pursuing “free projects” in which students not only choose how to accomplish a programming task — they also choose (or discover) the direction of the project. Students are assigned a free project each week; each of these, from each student, is presented at least briefly in class. There will be some time for longer discussion and critique, but even the short presentations by students will serve to show the variety of perspectives in the class and the many ways in which programming can be used to explore. To supplement the learning that happens by programming, the instructor’s textbook Exploratory Programming for the Arts and Humanities is used. (Although this book is available as an e-book, it is designed for use as a bound, paper book alongside a computer.) The course is not based around lectures, but there will on occasion be short explanations of particular concepts as part of the workshop environment.

Format for Meetings

The class meets 7pm-10pm on Tuesdays and 12noon-1pm on Wednesdays, with both meetings taking place in the same room, 1-242.

Students must bring a laptop/notebook computer to each of the sessions, and it must be properly set up and ready for use in class. You can do work for the class using any major OS: GNU/Linux, Mac OS X, or Windows. You may be able to borrow a computer from the IS&T Laptop Loaner Program, but it needs to be set up properly for use during our class meetings. Students must also have the textbook on hand. Finally, students must have their own code from previous classes and from their project work between classes available to them during our class meetings.

During the longer Tuesday meeting students will initially be asked to follow the instructor’s lead, typing in code verbatim at first and then seeing what can be done with variations at the levels of data, parameters, and more complex operation. We will show work on free projects that we began the previous week. We will also do some in-class exercises and have discussion of related topics, ranging from detailed questions that may seem purely technical to issues that are more obviously cultural. At the end of Tuesday we will the main identify outstanding questions students have about the material covered so far.

Wednesday meetings will explicitly address these questions, along with any others that arise during the Wednesday session. Students who find the material clear at the end of our Tuesday time are nevertheless asked to come to these Wednesday meetings and be present in the classroom community; if some do not need clarification, they may work on their free projects during our Wednesday sessions.

Students are expected to learn by being in the classroom for discussion and in-class work on their computers, by reading and reviewing the material in the book, by pursing their own small-scale (week-to-week) projects that they develop by themselves, by considering fellow students’ projects inside and out of class, and by consulting the programming environment itself to determine how it works — trying things out in the Jupyter Python notebook, for instance. It would be extraordinarially surprising if a single channel of learning, or even two of these channels, were enough for a student to exhibit excellent understanding and become a good exploratory programmer. A serious effort along all of these channels should be, however, whether or not a student has any prior experience programming.

The schedule below only indicates what is planned for our Tuesday meetings; what we do on Wednesdays will be determined as the course progresses.

Before the First Class

1. Install Anaconda for Python 2.7

Students must have Jupyter Notebook (formerly called iPython Notebook) installed with the current version of Python 2. We will be using Python 2 (a currently maintained version of Python, in no way obsolete) in this class. Python 3 also exits, is slightly different, and will not be used in this class. Python 2 is the standard version that comes with most Linux distributions and Mac OS X, and it is the version used in the text. To install what is to get started with Python, download and install Anaconda for your operating system, being certain to choose Python 2.7. For those of you have have a version of Python already installed, you will get another one in addition to that when you install Anaconda. It’s no problem. Everything should work fine.

2. Install/Have Ready a Text Editor

You need a true text editor installed. I will not attempt to link to all the reasonable choices for each OS, but here are comments on making sure you have an editor or selecting an editor to install:

3. Install TextBlob

In addition to the libraries that come with Anaconda, we need TextBlob, a Python library for manipulating text. We’ll use it later, but we’ll be sure we have it installed and working by the end of the first class. Installation is done using the program pip on the command line as indicated on the main TextBlob page.

Note on “Free Software”

When I mention “free software” I am talking about it in the sense that the Free Software Foundation does. I don’t mean simply that it is priced at zero dollars, but that it comes with certain freedoms, to run, copy, distribute, study, change and improve the software. For these reasons, as we'll discuss further during the course, the concept of free software is connected to exploratory programming.

February 6

1. First Steps

For this class meeting only, we will have two expert exploratory programmers joining us to help out, Aashka Dave and Aziria Rodríguez Arce, second-year CMS graduate students. Last Spring, Aashka and Aziria both completed independent study for credit using the Exploratory Programming textbook.

After ensuring everyone has their own personal comptuer set up properly, we will look at several historical text-generating systems that have been reimplemented as JavaScript programs, packed up with HTML and CSS into Web pages. These can be found in the Memory Slam collection. We’ll see how to download these pages, edit them in text editors, and begin learning about programming through this sort of study and modification. We’ll explore the difference between code and data, continuing to learn some about how parameters work. Students will undertake their first free project, creating a text generator based on an existing one, as an in-class exercise. This is the only work we will do in JavaScript; we will use Python for the next part of the course.

Guests during the last hour: Rafael Pérez y Pérez, a professor of computer science at UAM-Cuajimalpa in Mexico City, and Allison Parrish, poet and teacher at NYU’s ITP program, will share some of their work and discuss the exploratory ways in which they develop it. All students are asked to share their free projects (simply by reading alound from them as they generate text) with the class, with Aashka and Aziria, and with our guests.

Assigned for next week: Read and type in the code from chapters 2. Calculating and 3. Double, Double. These chapters will be covered quickly at the beginning of our next meetings, which will move on to the material in 4. Programming Fundamentals.

February 13

2. Programming Fundamentals

We will review syntax errors and semantic errors, how error messages can help us and when we will need to rely on other types of reasoning about programs.

Then, we will cover the programming fundamentals discussed in chapter 4, including functions and scope, iteration, types and polymorphism, and the conditional. The double() function introduced in the reading, and so far only considered from the “outside,” will be considered in light of these fundamentals and its inner workings will be explained.

Assigned for next week: As a free project, make two modifications to two Python programs: double() and the Python version of the Memory Slam program you have already modified, in JavaScript. Begin by making essentially the same modification you already made, in class and in JavaScript, and continue to modify and develop either that text generator or another one in an exploratory way.

February 20

3. “Hello World” and Other Standard Starting Points

Corresponds to chapter 5. We will discuss how computing is introduced and presented as cultural; we will also do in-class exercises to understand programming fundamentals better. A very introductory sketch of object-oriented programming will be presented.

Assigned for next week: Complete all of the exerices in the text. For discussion in class, the free project is to write a “starter program” of no more than 280 characters in Python 2.7. You get to choose what aspects of computation you wish to foreground and how you would like to introduce computing to those new to programming.

February 27

4. Text I: Slicing, Splitting, Joining, and Sorting Strings

We’ll cover the basics of text manipulation, which end up offering a fair amount of power to those interested in computing on language. We’ll focus on short strings during this class session., and will do some in-class exercises.

Assigned for next week: Complete the remaining exerices in the text. In additoin to these, a very simple free project is assigned: Write a function that will generally transform sentences (you can assume English sentences, if you like) in a way that you find interesting using just split() and join().

March 6

5. Text II: Palindromes and Regular Expressions

Palindrome verifiers of several sorts are developed in class. The essentials of regular expressions are described.

Assigned for next week: Work some every day with regular expressions in your text editor. As a free project, develop a system to detect palindromes or other unusual lexical phenomena in large text files. You could detect tautonyms (from the previous week’s exercise) or charades/redividers (onus on us, together to get her), for example. You should choose the phenomenon, and select one that is fairly easy to detect using simple text processing methods.

March 13

6. Image I: Pixel-by-Pixel Transformation

March 20

7. Image II: Filters

April 3 - No class — Spring break!

April 10

8. Some In-Class Bytebeat Sound, Text III

Bring headpones! As an invigorating activity for our return from Spring Break, we will spend about an hour making unusual musical compositions, in bytebeat format. Those who are keen on sound and music can dive further into this individually or even do a bytebeat “very free project.”

Afterwards, we’ll continue to do some advanced work on text using TextBlob, a Python library which provides wrappers for WordNet and NLTK and offers access to various corpora.

Assigned for next week: As a free project, develop a system to compare two book-length texts such as those from Project Gutenberg. You should trim the paratextual and license information from the files you are comparing.

April 17

9. Statistics & Visualization, Python & Processing

We consider how to use programming to do some basic statistics, for two important reasons: First, statistics is quite useful as a way of understanding all sorts of cultural data and can be used in developing artistic projects; second, this gives us the opportunity to see how Python and a particular variety of Processing, p5.js, can be used to do the same thing. Why do the same thing in two different programming languages? To show us that our ability as programmers is in some ways general. We are not just learning Python, but a new way of thinking and using computation.

Assigned for next week: For your free project work, develop one generative and one analytical system that allows you to work with and think about statistics. For your generative system, rework an existing Memory Slam text generator (either one of the original ones or a modified one that you developed) by keeping the texts the same and changing only the distribution of those texts. For your analytical system, write a short program in Python that will read a text file line by line and compute statistics of the lines. Note that your analysis program will be more meaningful when applied to poems or other texts that have meaningful lineation, so you should write it with a particular genre in mind (poems, status updates, tweets, etc.) and provide it with suitable data.

April 24

10. Animation

We will see how to computationally specify animations in Processing, and specifically in p5.js (which is not the variant of Processing used in the textbook).

Assigned for next week: The now-famous clock project, which I and others have been assigning for the past decade. Designing a (non-interactive) clock is an interesting project because your program must be general: It must present an appropriate display of time at any point during the day. But it does not rely on getting keyboard, mouse, or touch-screen input or using randomness. It allows for a great deal of freedom for clock designers. Create a display of time in p5.js that makes the time legible to yourself and others, but presents the time the way you would like it presented.

May 1

11. Interaction

We will see how to make interactive sketches in p5.js (again, not the variant of Processing used in the textbook). Handling input is not a big step beyond what we have already done. We will also look to how input can be used to naviage a virtual space that is larger than the screen or window.

Assigned for next week: The generated landscape. This is a project with considerable freedom, but there are several requirements. First, everything shown must be generated by code rather than simply stored in data. Second, what is shown in the window must only be one part of the larger landscape. Finally, the user must be able to move through this landscape using some sort of input — pressing keys, moving the mouse, etc.

May 8

12. The Very Free Project

We will share and discuss our generated landscapes. Beyond that, there will be time for any outstanding questions about the course material and approach, and time to work in-class on the final “very free project” for next week.

Assigned for next week: The very free project. You should continue some work you have done earlier in the semester to develop something significantly new. You can do work with text, image, statistics and visualization, animation, interaction, even sound (which we will have only worked with a bit during part of one class). Your project can be generative or analytical. Keep in mind that you are not doing a large-scale “term project,” but just doing another weekly project, so you are not expected to exert a massive effort. You should, however, try to take a meaningful next step.

May 15

13. Onward

We will share and discuss our very free projects. We’ll also discuss how to continue our work as exploratory programmers and some additional ways that exploratory programming relates to cultural issues.