Teaching code

Since September 2013, I’ve been volunteering twice a week for an hour and a half at a high school in downtown Brooklyn where I, along with three other developers, teach the basics of HTML, CSS, and JavaScript to about fifteen students. This post is a collection of some of the observations I’ve made during that time.


When I quit my job two years ago to pursue a startup, I had a new, more flexible work schedule. I wanted to use this as an opportunity to do things I had neglected in the past such as exercising regularly, cooking regularly, and keeping in better contact with friends. I also wanted to give back to my community on a more frequent basis. For reasons that deserve another post, I had realized that my mental happiness was connected to, among other things, helping those around me. It was difficult to feel inner satisfaction without volunteering some amount of my time to bettering the social conditions of others.

I had a casual interest in teaching and I absolutely loved coding so I thought I’d try to marry the two and teach people how to code. After some googling, I came across a non-profit that puts developers in high school classrooms across NYC. And so I signed up.

Knowing versus teaching

I didn’t bother preparing for the first couple of classes. Writing “hello world” in HTML, making the background of a page red, changing font sizes? Please. I could do that in my sleep. And so, with supreme confidence, I walked into class and starting teaching.

And failed pretty quickly.

Only later did I realize that there’s a big difference between practicing knowledge and being able to reproduce it. The latter requires one to present said knowledge in a form of narrative so that someone with little command of the context can understand. Most of my students had never programmed in the past so they couldn’t rely upon the same contextual clue base I could. This meant I needed to prepare a narrative in advance of class (otherwise known as lesson prep). It also meant coming up with real world analogies. A vending machine is like a function: it takes inputs (in the form of money and code selection) and outputs a single item (the drink or snack).

Teaching also forced me to better understand the “why” behind certain things. I couldn’t teach a fact, wave a magic wand, and have everyone commit it to memory. It had to make sense and the only way I could do that was by explaining the rationale behind the fact. Variable names cannot have spaces in them because the computer cannot tell if you are trying to make one variable or many.


I teach at an international school. My students came to the United States in the past four years. For most, English is their second language. Being able to explain a highly technical domain (programming) using high school level vocabulary is hard. I’ll constantly catch myself using a word like “functional” or “user” and self correct. If I don’t self correct, the three other co-teachers usually will.

Over time however, I will introduce these words to my students and ask them to memorize it. I firmly believe one must talk like a programmer before one can be one.


Last year, my students and I would recite the following mantra: humans are smart, computers are dumb. While a generalization, I used it to communicate an important point: we must be precise with computers and tell them exactly what we want. Computers cannot make the same assumptions we humans can.

Syntax errors, misnamed function calls, and plain typos can kill the morale of a beginner programmer. Connecting these errors to the inability (or “stupidity”) of the computer blunts this frustration by shifting the blame off the programmer. It also provides a brief source of levity. Repeat the mantra with a class of high school students and you’ll know what I mean.


Perhaps the most difficult challenge I had when I started out teaching was with keeping control of the classroom. The biggest mistake a teacher can make when interacting with students is by treating them like adults. Students look to the teacher as a source of authority. The moment they don’t see that is the moment they lose focus and drive.

This means being “mean” sometimes. This means cutting students off, passive-aggressively waiting for them to be quiet, and metting out a stern reprimand if no one does their homework. Tactics deemed unimaginable when dealing with adults are sometimes required in a high school classroom. And while students may disagree at first, deep down I think they appreciate a classroom that is in control and has high expectations.


High school students and teachers have different priorities. High school students want to have fun and teachers want to communicate knowledge. I’ve found the best teachers occupy a middle ground. Much like how Jon Stewart uses comedy as a vehicle to deliver facts and opinions about the news, a good teacher will leverage humor to communicate facts on a certain subject.

The first lesson of the school year involves role play. One teacher is designated as a robot and is stationed at one end of the classroom. Their task is to pick up a piece of paper on the other end of the classroom and throw it in the garbage. The students are responsible for guiding the robot to perform this task. Instructions such as “go to the chair” will elicit a shrug from the robot (the computer only understands a predefined set of simple commands). A request to turn 30 degrees to the right and go straight will send the robot tumbling into whatever and whoever is in the way until it is told to stop (computers are dumb and need to be told exactly what to do at every point).

Students (and teachers) break out laughing everytime we do this exercise. And that will help them remember the underlying point—that machines need to be spoken to precisely—even better.


Some of my past students have gone on to do programming internships at organizations like Ghostery and Teach for America. Others have gone on to pursue computer science in college. Remembering where they were on day one and how far they have triumphed since then leaves me speechless.

When I was a student, our teachers asked us to keep in touch with them. I now understand why. They want to see what imprint, if any, they left on their students as they went on to pursue their careers. I hope I leave something positive behind—programming related or not—with my students. I’m genuinely curious to see where they end up.

Parting thoughts

Coding is rewarding and teaching is rewarding. Being able to do both at the same time is pretty much the dream. If you’re a developer in NYC and want to get involved, hit me up. I’m happy to talk more.

Here’s a picture of the crew from a hackathon last year:


Written on March 7, 2015