Jan 15, 2018

Adding tail call optimization to a Lisp interpreter in Ruby

I spent the past week doing a programming retreat at the Recurse Center in New York City. One project I worked on was writing a simple Lisp interpreter in Ruby, following the excellent make-a-lisp tutorial.

One of the more educational steps was adding support for tail call optimization. I had used tail call optimization before and had a vague sense of how it worked, but it always sounded complicated. Implementing it in a toy interpreter was a great way to understand it better, and it turns out that the core idea is actually very simple!

In this post, I’ll show you why we need tail call optimization, and exactly how I implemented it in an interpreter with a surprisingly small set of changes to the code.

Read more

Dec 15, 2015

Five Books I Loved in 2015

One of my goals for 2015 was to read more books.

As someone who grew up doing the majority of my nonfiction reading on the Internet, I’ve been increasingly realizing that books are a better use of my time. They typically contain deeper, more coherent thinking than most blog posts and news articles, and I also retain information better when I read it in a book, probably because I spend a longer period of time thinking about a set of related ideas.

Even though I still spent way too much time on my smartphone, I managed to be mildly successful at achieving my goal, which is a better result than I can report for most of my New Year’s Resolutions! Here are five books that I most enjoyed reading this year.

Read more

Oct 7, 2015

Gaining faith in the future of government: CfA Summit 2015 recap

I’m sitting in a packed conference room, about to see a talk by Todd Park, who famously led the “tech surge” that saved Healthcare.gov. Before he speaks, I notice Park standing at the side of the room, fiddling with his iPhone, face expressionless. I’m expecting a pleasant, if slightly bland, presentation.

But the moment he’s introduced, bam, he sprints up to the podium—not a leisurely politician-jog-up-the-stairs, but a full Usain-Bolt-out-of-the-starting-blocks sprint—nearly tripping over a mic cable along the way. “HELLO!!!” he shouts, smile beaming, arms waving wildly. In the span of 10 seconds, he’s already completely transformed my image of a “government tech worker.”

Read more

Feb 28, 2015

Building Waze for the Boston subway: my first adventure in civic hacking

Last weekend I attended CodeAcross Boston 2015, a civic innovation hackathon hosted by Code for Boston as part of the national CodeAcross weekend.

Having been driven insane by the wintry woes of Boston’s public transit system, my idea for the event was to build “Waze for the T” – a crowdsourced alerting system to let commuters directly warn each other of delays, crowded platforms, and other problems on the subway. (The T is Boston’s nickname for the public transit system.)

I joined forces with two coworkers from Panorama Education, and over a weekend we built out the idea as a mobile web app using Meteor. We affectionately called it MBTA Ninja. (As weird as the new gTLDs are, .ninja domains are a gold mine for hackathons!) We weren’t really expecting anyone besides our coworkers and friends to use the app at first…

…and then it went viral on Twitter.

The last week has been a whirlwind. In just five days, 14,000 people have visited the site over 21,000 times. It’s been featured on various news sites, and we even got interviewed for local TV news on Thursday—the clip does a great job of telling the story.

In thinking over this experience, I’ve come away with two main thoughts.

Read more

Jan 1, 2015

2014: A year in review with iPhone pedometer data

About a year ago, I became interested in all the recent discussion about how “sitting is the new smoking,” and decided I should start monitoring my daily physical activity. The timing seemed especially good since I would be able to monitor my transition from being a college student to having a job, which makes it harder to live an active lifestyle. I was considering buying a Fitbit or Jawbone Up, but a friend recommended the fantastic Argus iOS app.

Argus uses the M7 motion coprocessor in my iPhone 5S to track my steps throughout the day without eating up too much battery life. Since I have my phone with me almost all the time, it achieves basically the same thing as a fitness wristband does, without having to worry about extra hardware. (This is a good example, among many, of smartphones assimiliating all sorts of previously separate hardware devices.)

Now that I’ve collected almost a year of data on Argus, I thought it would be a good time to use that data to gain some insight into my past year and set goals for the coming year. After all, a proper 2015 New Year’s Resolution should be data-driven!

Read more

Oct 3, 2013

Databases talk

Last weekend I gave a talk about databases at the HackNY Masters conference with my friend and fellow Yale CS major Seth Thompson. We covered some of the basics of database technology, and gave tips about how to choose which database to use for an application without getting caught up in buzzwords. My favorite part was explaining the eventual consistency model in Amazon DynamoDB–who knew that consistency wasn’t always a requirement of a production database?

Check out the slides here:

Jul 6, 2013

On spaghetti code

Last summer, I found time after work and on weekends to build a small web project called Yale Classroulette. It’s a way to randomly explore the enormous Yale undergraduate course catalog – just tap the spacebar, and your screen fills up with a new grid of randomly selected classes, optimized for easy skimming. It basically combines the experience of skimming aimlessly through a paper course catalog with the convenience of the Internet.

I built the site for fun, and because I wanted to use it myself. It turns out other people wanted to use it too–in the year or so since it launched, Yale students have viewed over 1 million courses on it, and the average time on site is 16 minutes. Not bad engagement numbers for a side project.

There’s only one problem with Classroulette. To put it bluntly, the code quality sucks. The Javascript for the frontend is a jQuery spaghetti mess with hardcoded constants and cryptic code, all polluting the global namespace. I wanted the random course loading to be fast, so the Sinatra backend fetches all the scraped course info from the database and stores it in a configuration variable upon initialization, because that was an easier in-memory data store to use than Redis. You get the idea. All this code was written in short shifts late at night when I was tired and distracted, and just wanted to get something launched. As an engineer, it’s painful to write and deploy spaghetti code.

But here’s what this project made me realize: sometimes, good code isn’t the top priority!

Read more

Page 1 of 2

Older posts