Why Humanities Students Should Learn to Code

Introduction

When humanities students think of programming, I feel like they often envision a solitary, dull activity, void of creativity or creative thought, when in reality, the truth could not be more different. In his 2010 blog post Hello Worlds, Matthew Kirschenbaum asserts that programming and and the humanities in fact share the common theme of what he calls “world-making,” making the both fundamentally creative activities.

More significantly, many of us in the humanities miss the extent to which programming is a creative and generative activity.

Kirschenbaum, Matthew. Hello Worlds (Why Humanities Students Should Learn to Program). 24 May 2010, mkirschenbaum.wordpress.com/2010/05/23/hello-worlds/.

Furthermore, I would argue that fundamentally, programming and the humanities look quite similar to each other. While the tools that programmers and humanists use look very different, they both share the common end goal of creating something new. Being able to code as a programmer is much the same as being able to write as a humanist: they are the languages used to create, and to bring something new into the world

My Experience

I would say that I am quite well experienced in coding. As a computer science major here at Carleton, coding has been a fundamental part of many of the classes I have taken. I have experience in programming in C, Java, Python, and many other languages and frameworks that build our digital world. JavaScript is an area that I do not have very much experience in, and I thought that the advanced JavaScript tutorial on HTML Dog did a good job of breaking many topics down. I particularly enjoyed learning more about the HTML canvas element, and how to interact with it through JavaScript.

I have included below a small code snippet that I wrote, as well as the canvas animation that it produces. The HTML canvas is a good example of the usage of programming to produce something creative. While the coding process itself looks very different from traditional forms of humanistic inquiry, the result is something that is novel and creative. While my example is quite simple, tools such as the HTML canvas can be used to create interactive and insightful forms of interactive media.

In addition to being a tool used to create, knowledge of programming creates more well-informed humanists who are able to adapt the critical thinking skills they possess to the digital world.

Code Snippet

var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');
canvas.style.border = '1px solid black';

var resize = function () {
  canvas.width = 600;
  canvas.height = 400;
}

window.addEventListener('resize', resize);
window.addEventListener('load', function () {
  resize()

  function Rect() {
    this.pos = {
      x: Math.floor(Math.random() * (canvas.width - 5)),
      y: Math.floor(Math.random() * (canvas.height - 5))
    };
    this.vel = {
      x: Math.random() * 8 - 4,
      y: Math.random() * 8 - 4
    };
    let hex = Math.floor(Math.random() * 16777215).toString(16);
    this.color = '#' + hex.padStart(6, '0');
  }

  const rects = [];
  for (let i = 0; i < 10; i++) {
    rects.push(new Rect());
  }

  var loop = function () {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.fillStyle = '#dddddd';
    ctx.fillRect(0, 0, canvas.width, canvas.height);
            
    for (let i = 0; i < 10; i++) {
      rects[i].pos.x += rects[i].vel.x;
      rects[i].pos.y += rects[i].vel.y;
           
      if (rects[i].pos.x < 5 || rects[i].pos.x > canvas.width - 7) {
        rects[i].vel.x *= -1;
      }

      if (rects[i].pos.y < 5 || rects[i].pos.y > canvas.height - 7) {
        rects[i].vel.y *= -1;
      }
                
      ctx.fillStyle = rects[i].color;
      ctx.fillRect(rects[i].pos.x - 5, rects[i].pos.y - 5, 14, 14);
    }
  }
  setInterval(loop, 1000 / 60);
})

3 thoughts on “Why Humanities Students Should Learn to Code

  1. I am super impressed by your code, Warren! I can’t believe this is a ‘small code snippet’ because that would have taken me forever. I can tell you understand JavaScript and HTML very well. Anyways, I definitely agree that programming is sort of given a bad name, but that it can realistically be a creative and limitless space for any student. I liked that you talked about that in your post. Great job!

  2. Warren, your code is amazing! It’s clear that you have a very deep understanding of the material this week. I really appreciated your insight on how programming and humanities are both trying to create something new, and I agree that sometimes programmers are depicted as “lone wolves”, however in reality, are more similar to those in the humanities than we might perceive.

  3. I really appreciate how you used your code snippet to prove your argument! Like you said, solely humanities and arts focused students may think that code is going to look and feel boring or dull and your animation shows that that’s not necessarily the case. There are many creative opportunities with coding, you just have to have that passion and creativity. While it might be hard to learn and be able to do creative things with coding, I feel that showing examples like these is a good way to inspire humanities and arts students to see the potential.

Leave a Reply to Emilia Rodriguez Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

css.php