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:

This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2008/01/what-can-you-build-in-600-lines-of-code.html

Here, let me post my 600 lines of code in the comments to your post!

And you thought the FizzBuzz post was bad :slight_smile:

FizzBuzz in 600 lines or less… Kinda like “Hello World!” in less than one line of code. (In other words… don’t bother, please.)

Good food for thought on writing concise and useful code. The key here is also NOT to turn in it into an exersize in obfuscation.

Thanks for this little tidbit!

Maybe I’ll go through some C app I’ve got, and remove the newline character from all lines that don’t start with #.

Then again, maybe not.

What can’t i write in one line of code and a little bit of insanity and an overused scrollbar?

with 600 line of code,
I can wipe out your hard drive
and fill it with useless junk
Isn’t that a lot for 600 line only ?
Frankly, if the point is to discuss which
programmer langage is more concise than other,
I would have expected a more instructive article.
And no, Ruby on Rail doesn’t look yet attrictive to me.

Well, I wrote a small webapp in PHP-SQLite for the library i work in that manages the entire movie loan process in less than 400 lines, XHTML+CSS included. Ok, it’s far from those web-two-dot-zero features, but it does the job… :slight_smile:

I remember someone writing a demo reversi game in ASP where the user played against the computer. I believe it was about 142 lines of total code HTML and VBscript.

I’m sure Larry Wall could have written that in 600 characters of Perl

#include "WordKiller.hpp"
int main()
WordKiller theApp(;
return theApp.run();

600 lines of Ruby? Try something ten times as good as Word, in just 6 lines of C++ (or 2, if you remove unnecessary breaks.)

Oh, yes, the WordKiller.dll “framework” will be a little larger, but what the hey. Noone else ever considers the “framework” size when harping on about their one-liners, so I

More seriously, here’s what I can write in 600 lines of legitimate code: a product that 50 thousand other developers could duplicate in a weekend. I could “write a product” but building a business would require something more, and not just in terms of code size.

If you have 579 lines of code plus a great deal more code that you’re discreetly ignoring, then you might have something non-trivial.

oops, I forgot I was referring to the 37 signals product.

And to add: XDDDDD

I once wrote a (horizontal) star scroller in 19 bytes. Switch to mode 13h, create random stars and make a loop that moves them. In 19 bytes. I’m still so proud of that :slight_smile:

Heh - I be it could be done as a APL one-liner - but no one would be able to read it, and figure it out

Is something they don’t charge for considered commercial? It’s a fairly trivial program, like Bob pointed out, one a competent programmer could probably code in around a weekend. (http://railsrumble.com/)

It is certainly nice that something useful can be created in this time frame, though.

As a user of BaseCamp, I’ve delt with the short comings – such as no Spell Check or HTML edit view. But all-in-all, for the basic $10 a month plan it is worth the money.

As a rails developer, I would like to say that that is 600 lines of code they actually wrote. A frozen rails 2.0.2 has 171,098 lines of code. Just didn’t want to have anyone misled.

I don’t know about writing less than 600 lines of code but I’m sure this should serve as good example to application and framework developers that writing short and clear code shall be possible. How many APIs have we used that required us to do so much for so little (hello Java :wink: ) ? How many applications were bloated with thousands of lines of code that could be reduced to half the count just by cutting on patterns and fancy “we’ll make it reusable because someone might think of wishing to reuse it” code ?

Tell me, does javascript count as loc? I can’t read chinese, so it’s hard to tell if it’s just lines of ruby? Anyone care to translate?

I watched Joe Stagner write an AJAX todo list in 20min. What can you write in 20 min? http://download.microsoft.com/download/0/f/6/0f651a0f-6f2b-4497-b061-e1b2825e22e0/MSAJAX-ToDoList.wmv

Apparently all I can write in 20 min is a useless blog comment.

Here is PhotoShop in 7 lines of code.

#include “Photoshop.h”

int main(int argc, char **argv)
Photoshop *app = new Photoshop();


www.bigbadjim.info:6060 has less than 600 lines of code. It is not complete, but what it is works.

I was not trying to be terse.