It’s only 10 lines of code, but it took 200 years to build

Why is there so much money thrown at web and mobile apps that a couple of people could hack together in a weekend? Why is so much time and effort spent on seemingly trivial products such as URL shorteners and social-location-based-mobile apps when we still don’t have a cure for cancer and we haven’t been back to the moon in 40 years?

Take the common attack: “that’s trivial, I could implement it in 10 lines of code“. (The actual number of lines is irrelevant, the sentiment is that anything simple to implement must not be worthwhile).

We’ll use Instagram as an example. Imagine you’re trying to bash out an MVP for a photo-sharing app as quickly as possible, focusing on only the core features — taking photos, uploading them, adding friends and letting them see your photos. That will likely take more than ten lines of code, but not much more — probably not more than a few hundred. A pair of competent eLance programmers could hack your demo together in a few weeks. The mobile app just glues together the iOS APIs for taking photos and file uploads. The server portion is just a basic CRUD app built on top of any of the big web stacks, running on commodity hardware.

Sure, you’ll likely need to add a few features before you flip for a billion dollars, but that’s more a product/design challenge than an engineering one. And you’ll eventually encounter scaling problems, but these days, scaling problems are rarely hard problems. The real Instagram had only two backend engineers but managed to cope with 40 million users, thanks to Amazon EC2 and a zoo of open-source software packages. Just write a few scripts that tie together all this infrastructure and off you go.

Hang on. What was that last sentence again? On closer inspection, our supposedly simple application turns out to be built on a mountain of complicated machinery.

You might be able to achieve amazing things with only a few lines of Rails code, but that’s only because the Rails framework consists of a hundred thousand lines of software. And just as much as your work is reliant on dhh and the rest of rails/core, those guys are mere journeymen programmers who are completely indebted to Linus Torvalds and the Linux team. How could a web framework work without an operating system to build upon?

(The Linux kernel, by the way, consists of over 10 million lines of code. Debian, the Linux distribuition which is serving you this blog post right now, consists of 300 million lines of code. It would take one programmer 15,000 years to re-implement.)

And, in turn, even a legendary programmer like Linus Torvalds is revealed to be a mere mortal when compared to godlike hackers such as Dennis Ritchie and Ken Thompson, the creators of UNIX, whose work he is completely reliant on. And so on back in history, until you realise that computers and the internet wouldn’t work at all without the communication and electricity networks that were built in the Victorian era.

And similarly on the client side. Your iPhone app might consist of just a few API calls, but how many millions of lines of code are required to implement those API calls? And how many man-hours of engineering from Apple, Samsung, ARM et al. are needed to create the hardware all these apps run on? And what about the people that built the 3G towers and GPS satellites that let you upload your filtered snaps and tag them with your location?

Sure, any single mobile app looks trivial. But the fact that mobile apps exist at all is not. Instagram would have been completely impossible thirty years ago. Nowadays, Instagram is ten lines of code.

But each lines of code is highly leveraged. Leveraged both in the financial sense — indebted to the millions of man-years of work that created all this infrastructure — and in the Archimedean sense — a tiny force with the ability to move the world.

Isaac Lewis

Hi there! I'm Isaac.

If you enjoyed this article, why not subscribe for more?

    4 Comments

  1. ping
    2012/07/13 at 9:34

    It would only be fair to credit Richard Stallman too, not just Linus Torvalds.

    Reply
  2. Scott Dutton
    2012/08/09 at 13:00

    Lines of code shouldnt be a metric when considering stuff like that anyway.

    http://folklore.org/StoryView.py?story=Negative_2000_Lines_Of_Code.txt

    The Linux Kernel is huge, But if youve ever worked with it you know its fairly bloated too. But even still its probably the fastest out there

    Reply
  3. 2012/09/06 at 3:26

    I can write a lot more than 20,000 lines of code in a year.

    Remember, it never works first time (though I can name a few exceptions, but they never did more than about 100 lines that worked first time.)

    John Bowler jbowler2acm.org

    Reply
  4. 2012/11/18 at 16:48

    ‘Bloated’, would it be correct to call it that? I’m no kernel programmer but I know it’s bloated for a reason – to make stuff work.

    Reply

Leave a comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>