Fog Creek

dev.life – Interview with Mary Rose Cook

In dev.life, we chat with developers about their passion for programming: how they got into it, what they like to work on and how.

Today’s guest is Mary Rose Cook, a Facilitator at the Recurse Center (formerly known as Hacker School). Passionate about sharing her programming knowledge, she is the creator of Code Lauren, a programming environment for beginners, and Isla, a live-coding interface and programming language for young children. She also wrote Gitlet, an implementation of Git written in JavaScript, which includes a heavily annotated version of the source, to help you better understand both the code and how Git works. There’s more on her blog.


Mary Rose Cook
Location: New York City, NY, US
Current Role: Interactive Media Design Facilitator at Recurse Center

How did you get into software development?

When I was eight years old, we had a BBC Micro at home. My Dad and I spent hours typing in BASIC code from a book that contained the source for some simple computer games. Inevitably, the games wouldn’t work. Understanding nothing of what we had written, we debugged by going through the source, character by character, to find things we had mistyped.

When I was thirteen I used ResEdit, the MacOS 7 resource fork editing program, to change icons and keyboard shortcuts on my parents’ Macs. Somehow, that led to me discovering the programming section at the local bookshop. I bought a book called Programming Starter Kit for Macintosh that I found hard to understand. (I remember being confused by functions returning error codes.) I abandoned that book after two hundred baffling pages and bought Mac Programming for Dummies. That was easier. Afterwards, I worked through Foundations of Mac Programming and this led to me writing a word processor, which was really just a window you could type into.

bbcMicro

Tell us a little about your current role

I work at the Recurse Center (FKA Hacker School).

The Recurse Center is a three-month programming retreat. The people who attend (“Recursers”) work on projects they choose. Their goal is to get much better at programming. Their experience levels vary widely: some have been programming for a few months, some for thirty years. We give grants to people from groups that are traditionally underrepresented in programming.

My job title at the Recurse Center is Interactive Media Design Facilitator. I spend part of my time working on my own programming projects, and I spend the rest of my time helping Recursers get better at programming. I help them find the right projects to work on. I pair with them on their projects. I review their code. I help them work out an architectural approach to a problem and I run workshops on subjects that interest me: functional programming, the graph underpinning Git etc. At their best, these activities lead to us diving deep into some code, or practicing systematic debugging, or thinking about some fundamental programming ideas.

In terms of my own projects, my last one was Gitlet, an implementation of Git in JavaScript. I wrote it to learn how Git works under the covers. I released a heavily annotated version of the source code as well as a long essay about the innards of Git.

I’ve also been giving free programming lessons in New York, using Code Lauren as a teaching tool. Code Lauren, is a programming environment for beginners, which I’m currently working on. The programmer uses the environment to write animations and small games. They use a simple, Lispy language and their program is re-evaluated on each keystroke. They can step through the execution of their program forwards and backwards.

The first hard part of this project was trying to make programming easier. I taught my wife some Python and noticed that she found certain things confusing. When should a function be called as a function and when should it be called as a method? What is the difference between literals and variables? In what order will this code execute? What variables are in scope? What value does this variable currently hold?

I designed the language to fix some of these confusions. I tried various ideas that didn’t work: replacing dot notation with a URL-like syntax, eschewing loop constructs in favor of map and its friends, a Lisp that used line-breaks instead of parentheses, a language that used postfix notation and had a stack with a short memory. And I tried some ideas that did work: creating an animation loop with a special construct that reads as English, using braces consistently to signal a scope and a block, only allowing functions.

I designed the environment to fix other confusing things about programming. The user can step forwards and backwards through their code to understand its order of execution. They’re able to mouse over things – parts of their animation, variables, pieces of syntax, arguments – to see information about state or what the code is doing. Error messages are written in plain language and are very specific and point out as many problems as possible.

The second hard part of this project was writing the compiler. I wrote version one to get something working. It used a PEG parser and had a simple, switch-statement-based interpreter. It never yielded to the JavaScript event loop, so it locked up the browser if the user’s program ran for very long. I then wrote version two to avoid locking up the browser and to let the user step forwards through their program. This version used generators to periodically yield to the event loop. Finally, I wrote version three to support stepping backwards through the program and support showing the program state. The generators I used for version two hid their state, which meant it couldn’t be copied and stored. So I wrote a compiler that compiled the parsed code into bytecode and a virtual machine that encoded the state of the user’s program in a call stack. This meant I could copy and store each program state. Stepping backwards is just a matter of restoring the previous state.

islaLanguge

When are you at your happiest whilst coding?

After I’ve come up with a possible way to solve a tricky problem, I really like writing the code to see if my solution will work.

What is your dev environment?

I run OS X on a Retina MacBook Pro 13”. I write code in Emacs and use iTerm 2 as my terminal.

What technologies are you currently trying out or want an excuse to try?

The Code Lauren build system uses ES6, which is a lot of fun. I’m also using React, which is making my UI programming reasonably easy.

A while ago, I wrote an interpreter in Clojure and a synth in ClojureScript. I can’t wait to go back and do another project with ClojureScript.

theMet

When not coding, what do you like to do?

I go to art galleries a lot, particularly the Met and the Frick. I see lots of films at the Film Forum, a great independent cinema in the West Village.

What advice would you give to a younger version of yourself starting out in development?

Be rigorous! When I was younger, I thought the only thing that mattered was having a working project. I think that attitude slowed me down because it kept me from understanding some things deeply. Now, I try and dive deep as much as I can.

 

Thanks to Mary for taking the time to speak with us. Have someone you’d like to be a guest? Let us know @FogCreek.

Recent dev.life Interviews

Jude Allred
Jude Allred
Richard Schneeman
Richard Schneeman
Dayle Rees
Dayle Rees
Chris Fidao
Chris Fidao