Sunday, July 10, 2022

Diversifying historical references in CS classes

 A few years ago, I discovered #DisruptTexts, a movement by teachers to challenge the traditional canon in English classes, i.e. spending less time on Shakespeare and more time on historically underrepresented authors.

I teach programming, not English lit, but I still wondered if there were opportunities in my curriculum to shift emphasis away from white male “authors” to people from other cultures. I realized that there are a few standard spots in programming courses that reference the inventor of some algorithm or concept, and that inventor is typically a white male. However, as a general rule, many "inventions" actually get invented by multiple people, and history books try to simplify it down to a single origin story. So, each time I found a reference to an inventor in my curriculum, I researched the web to find any additional inventors.

Here’s what I found for the topics I taught last year:

Fibonacci → Virahanka

When teaching iteration or recursion, I often show how to calculate the numeric sequence where each number is the sum of the two numbers before (1,1,2,3,5,8,13,…). 

The sequence is typically named after Fibonacci, an Italian mathematician from the middle ages who encountered it while modeling the reproduction of rabbits. 

Slide on Fibonacci's study of rabbit reproduction

As it turns out, a Sanskrit grammarian named Virahanka discovered the same sequence many centuries before, while modeling the syllabic structure of Sanskrit poetry. 

Slide on Virahanka's study of Sanskrit poetry

I love when programming and linguistics overlap, so i was fascinated to learn about Virahanka's sequence. To acknowledge the earlier discovery, I added slides on Virahanka and renamed the fib functions in CS61A to virfib.

def virfib(n):
  if n == 0:
    return 0
  if n == 1:
    return 1
    return virfib(n - 1) + virfib(n - 2)

Backus-Naur → Panini-Backus

Backus-Naur Form is a notation for describing the rules of a language’s grammar (as long as it is context-free). IBM engineer Peter Backus invented the notation in the 1950s to describe the grammar of Algol programming language:

Screenshot of section on syntax of for statements from ALGOL report

BNF is still used today to describe the grammar of modern programming languages. For example, the SQLite syntax reference uses railroad diagrams, a visualization of BNF grammar rules:

Screenshot of DELETE reference for SQLite

I was amazed to discover that this recent “invention” also has a much earlier origin story from the study of Sanskrit. Around 500 BCE, a grammarian named Panini used a formal notation to describe Sanskrit, and that system was very similar to what Backus created in the 50s. I won't share the Sanskrit rules since I don't read Sanskrit and can't be sure of what I'm sharing. However, here's a grammar diagram from a Sanskrit teacher:

Grammar diagram for Sanskrit

As you can see, the construction of a word in Sanskrit follows similar flows as the construction of a DELETE statement in SQLite. There are elements that can be repeated, elements that must be at the beginning or the end,  recursive elements, etc. Those are the sorts of requirements that could be described both by Panini's 500 BCE notation or by Backus' 1950s' notation. 

For that reason, some propose renaming BNF to Panini-Backus form. I did not end up doing that when I taught BNF, since we were also teaching EBNF and I wasn’t prepared to also rename that. However, I do mention its much earlier invention in India when lecturing in class.

George *and* Mary Boole

One of the most foundational concepts in programming is logic, the way we can combine true/false expressions using AND/OR/NOT/etc, and yield a true/false result. That’s called Boolean logic, named after the English logician George Boole who described the system in the 1854 book, The Laws of Thought.

George Boole was married to another mathematician, Mary Everest, who also wrote books on math, despite living at a time when women weren’t welcomed in academics. Mary is known to have contributed heavily to the editing of George’s book and was a loud proponent of its ideas after George’s early death. I am certain that many inventions of married men throughout history were helped significantly by their significant others but not attributed to them. How many women and non-binary inventors would we know about today if history wasn't so rife with patriarchal systems?

Fortunately, we know about Mary’s contributions. Heres how I describe it in my co:rise Python course:

Booleans are named after George Boole, a self-taught logician. He described a system of logic in an 1854 book, The Laws of Thought, that was edited by his wife Mary Everest Boole, another self-taught logician. According to Mary, George was inspired by Indian logic systems dating back to 500 BCE. We can actually find the origins of many "modern" computer science concepts in ancient systems of India, Africa, or the Mediterranean.

And look, another reference to Indian scholars from thousands of years ago! It makes me wonder how many times logic was independently invented across the world.

Those are the places I found so far where I could diversify the historical mentions. Unfortunately, most inventors are still male and from the upper class of society, since we history rarely hear from oppressed genders and classes. 

I’d love to know if other CS teachers have discovered ways to #DisruptTexts in your CS classrooms. 

No comments: