a blog about programming and startups by Brian Brunner

Learning a new programming language? You should build redis

01 Apr 2014

When I’m learning a new language, I’ll often start with a widely recognized guide (something like Learn You A Haskell) and then, almost always, my next step is to go full steam and build a clone of redis. My goal is to get a working datastore that speaks the redis protocol, saves to disk, and implements all of the basic data structures along with most of the operations you can perform on them.

I like this approach because it gives you a pretty cool end product (a fully functioning datastore) and also forces you to understand a great deal of concepts in a new language. To build redis, you need to be able to do a pretty wide number of things.

  • Understand networking for accepting client connections.
  • Understand file operations (reading configs, backing up your data to disk)
  • Understand string parsing for interpreting the redis protocol.
  • Understand builtin data structures in your new language (Lists, Sets, SortedSets, Hashes)
  • Understand concurrency (multiple clients, one underlying datastore)
  • Understand object serialization for writing objects to your backup file
  • Understand how to structure a project in your new language
Read More

Replacing the Standard Library - Python Requests

31 Mar 2014

Sometimes, a language’s standard library is so poorly exposed, undocumented or outdated that it warrants using an external package to replace it.

In Python, making HTTP requests is shockingly cumbersome. A basic GET request is easy enough.

import urllib2
response = urllib2.urlopen('')
html =

But once you start getting into more complicated things, you enter a world that grows increasingly more painful. For example, a post request looks like this.

import urllib
import urllib2

url = ''
values = {'username' : 'bbrunner',
          'fullname' : 'Brian Brunner',
          'requests' : True }

data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page =

And if you need to get json back, that’s another import you need to remember. If you want to add in auth or coookies or read compressed data or do anything else that is totally fair game for interacting with HTTP services, urllib/urllib2 pretty much sucks. I’m not going to go into any more examples, because we’d be here all day trying to sort out issues.

Read More

For the Love of God, Ask FizzBuzz

25 Oct 2013

Software engineering interviews are a very open-ended art form. Every company puts their own particular spin on things so that they can figure out whether or not a candidate is both qualified and a good fit for their team. But there is one thing that I strongly believe every single company should do when interviewing: ask FizzBuzz.

Just to be clear, I don’t literally mean that you should ask the specific FizzBuzz problem. You can ask any sort of basic, non-brain teaser problem you want.

  • Count the number of words in a sentence that start and end with the same letter.
  • Print out every other odd number in a list.
  • Or, to blatantly steal a question that one of my coworkers likes to ask, print out the diagonals of a matrix.

And so on. The point is to figure out whether or not someone can actually code.

Read More

Paying Money To Save It And Doing More With Less

23 Oct 2013

Recently, an email thread got started on the all-team mailing list at my office. Everyone in the company, devs and non-devs alike, was asked to take stock of all of the different SaaS products that they were using. When all was said and done, the list that we had compiled numbered around 40 different websites, most of which we pay some monthly fee for.

This was a little bit of a surprise for me, as we’re a team of less than 20. This means that we use twice as many SaaS products as we have people. If you want to unbundle all of the different services we use that fall under the umbrella of AWS, that number jumps from around 40 to more than 50. Basically, we leverage the crap out of other people’s software.

Incidentally, most of the software we pay for on the engineering side of things has open-source equivalents that we could run ourselves for free (besides hosting costs). We were recently looking to put together an automated testing setup for our frontend code, and one of our engineers offered to set up Jenkins to take care of it. It took all of a minute to decide on a managed, paid alternative instead. Because it was, without a doubt, much cheaper.

Read More

Computer Science in Real Life: Namespacing

25 Sep 2013

I spent this past weekend in Stowe, Vermont as an impostor in a room that didn’t belong to me. Well, technically, it didn’t belong to my fiance, so I guess she was the impostor.

We got to our hotel at around 11PM, too late for checking in at the front desk. We found what we thought were the keys to our room in an envelope sitting outside the front door. The envelope had my fiance’s last name, Lynch, on it. Upon opening the envelope and reading over the enclosed receipt, I realized that we had gotten keys not to our room, but to the room of one Vicki Lynch.

I’m not sure if Vicki checked in late too and grabbed our envelope by accident or if the front desk clerk had checked her into our room earlier in the day. Either way, someone had messed up. And really, this all could’ve been prevented with a little extra namespacing.

Read More

subscribe to my mailing list