Andrew M.H. Alexander

ballet : climbing :: math : programming

25 July 2018

I went to my second ballet class last night. Ten minutes before the end, an analogy occurred to me:

ballet : climbing :: math : programming

I’ve been thinking all year about how surprised I am at how much I enjoy, and how good I am, at grading coding assignments, and teaching coding. I think it’s related to the fundamental difference between doing math and coding: when you’re doing math, you’re both a) the person creating the theorem, and b) the person checking the theorem. You’ve got to come up with the ideas and work them out, AND you’ve got to make sure you’re right and you haven’t made any mistakes. In essence, you’re fighting yourself. You’re the defense attorney, AND the prosecutor. That’s hard! But when you’re coding, those two roles get separated. You don’t have to figure out if your program works—the compiler will tell you that! You can just come up with ideas, and see if they work, and if they don’t the compiler/interpreter will happily point it out to you. You don’t have to be in this anxious position of jumping from the plaintiff’s table to the defendant’s table and back again.

Doing math and writing code are in many senses very similar. You’re working in a formal language using deductive reasoning. But the existence of a more explicit/articulate external source of truth in coding makes it feel, in a lot of ways, distinct from doing math.

Doing ballet, I realized, is kind of like doing math. I’m standing there, trying to make all these various shapes with my body, and I’m also trying to check that I’m making the shapes correctly (by looking in the mirror, by looking at M. the instructor). It’s like proving a theorem: I’m trying to do the work, AND I’m trying to make sure that I’m doing the work correctly. Two very separate challenges!

Contrast with rock climbing (like ballet, a movement-based discipline/sport). In climbing, you have to figure out how to move your body so you can get up the rock. If you move your body incorrectly, you don’t get up (and/or you fall). In that respect climbing is like programming: there’s an external, objective authority/source of truth. You can’t bullshit your way up a climb. You can’t bullshit your way to a working program 1. In comparison, toward the end of ballet class last week, I was totally slacking off and ballet-ing shittily, since I was tired. And I basically got away with it. (I mean, I danced poorly, but it’s not like I was taking a whipper, or the compiler was screaming at me.) 2

I brought this up with R. at post-ballet ice cream. She said, yeah, that basically makes sense, at least at the lower levels. At a more advanced level, though, there IS an objective source of truth you have to conform yourself to: physics. If you’re trying to do some really complicated move (she gave an example), and you don’t do it quite right, then the physics doesn’t work out and you lose your balance and fall down. But the beginner stuff is sufficiently simple that it’s possible to do poor versions of it without falling over. (She added that she thinks M. uses the barre too much when she teaches, and that can be a hindrance. Students can rely too much on it to keep their balance, using it as a literal crutch, and thus not be forced to do the moves as well or as properly.)

(I feel somewhat weird philosophizing and coming up with grand analogies after literally two dance classes ever, but also I have no problem with this being a very superficial analogy. Superficial analogies can still be informative.)

  1. Of course, you can write an UGLY program that still works, and you can climb in a way that’s UGLY and GRACELESS but still gets you up the wall, but that’s a different distinction. 

  2. One stylistic corollary to all of this is that in both coding and climbing, I find that I take almost an EMPIRICAL approach, of trying random things and seeing if they will work, without necessarily expecting them to or having an underlying theory of why they might. Code doesn’t compile? Change this random thing! Does it work now? No? Change this other random thing! Does it work now? Yes? Great! Let’s try and figure out why! Same with climbing: hmm, I’ve tried the three obvious ways I can think of of making the next move, and they haven’t worked, so maybe I’ll just try contorting my body in different random ways, and one of them will turn out to work? And once it does, THEN I can try to think about and understand why it worked. This intrigues me, because (at least with coding) it’s like I’m thinking inductively about a deductive system.

    (I don’t think this point goes very far, because I think anyone at a reasonably advanced level is going to be conceptualizing a lot of their work in math/ballet as being about trying things and seeing what works, but…)