Coding Horror

programming and human factors

What Can You Build in 600 Lines of Code?

Joseph Cooney reminds us that, in January 2005, 37signals went live with a product they built in 579 lines of code:

You read that right, not 60,000 or 600,000 but instead a commercial project written in less than 600 lines of Ruby code. When I first saw this number I was incredulous -- I've written stored procedures that are longer than that. My current project has more lines of configuration than that. I've even written console apps in notepad, and compiled from the command line with more lines than that, because I thought they were so small they didn't need a whole .sln and .proj file, and yet here is 37signals going live with a product that is just 579 lines of Ruby.

As noted in the Rails blog, the original product launch was covered on Ruby language creator Matz' blog in his native Japanese. Surprisingly, the relevant facts are still readable:

matz makes notes of ta-da list and Rails

Of course, a simple lines of code number isn't the entire story-- they actually built the entire Rails framework first to support building small apps like ta-da list. None of the required Rails framework code, nor any of the the necessary stylesheets, JavaScript, HTML, and so forth, are included in that number. Still, I agree with Joseph: it's an impressive achievement, and it can lead to some interesting thought experiments:

I have a few interesting product ideas from time to time. What is the absolute minimum amount of code I could write that would make those ideas work? If I'm prepared to operate within the constraints of the platform (whatever that is) how much effort would that save me? How many more "interesting ideas" could I turn into working products if I was prepared to follow these constraints? How many more cool/useful things could you build if you promised yourself that each one would only be 600 lines of code?

What can you build in 600 lines of code? Think of it as an exercise in minimalism. Does your preferred language or environment allow you the freedom to create something interesting and useful with that constraint in place?

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Exchange and Discourse. Disclaimer: I have no idea what I'm talking about. Find me here: http://twitter.com/codinghorror