# What is the biggest program ever written?

**URL:** <https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430>\
**Category:** Factual Questions\
**Created:** [June 12, 2006, 3:00pm UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430 "2006-06-12T15:00:24Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [June 14, 2006, 2:31am UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/21 "2006-06-14T02:31:19Z")

</div>

[QUOTE=Emerald Hawk]  
Lines of code is a much better metric to use, and indeed is what most software companies use to measure complexity.  
[/quote]  
Write a mathematical program in C and write something functionally equivalent in APL. Tell me that you still believe that SLOC is a good measure of complexity.

> [@](#):
>
> If we also define a program as something that completes a set of related tasks, then we can start looking at candidates. I think Windows Vista is probably a good contender, even if we exclude the web browser and media player. Most estimates tend to put its lines of code in the tens of millions. Even all of the major government software projects I’ve heard of only run into a few million lines at most.

How about counting all of the Unix command line utilities (shells included) as one program and totting up the SLOC for all of that? That makes about as much sense as considering the Windows Vista kernel and all of its components as one program.

If any two components that communicate across an API can count as one program, then the largest program of all is the Internet.

---

<div class="post-metadata">

**Author:** ![dotchan](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@dotchan](https://boards.straightdope.com/u/dotchan)\
**Post date:** [June 14, 2006, 2:32am UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/22 "2006-06-14T02:32:56Z")

</div>

[QUOTE=psychonaut]  
No it wouldn’t. I could generate an arbitrarily large program that simply repeatedly outputs the phrase, “Hello, world!”, and make it provably correct (i.e., bug-free).  
[/QUOTE]

Why would ya need to do that when all you need are a couple of nested loops? 😉

(Then eventually the computer runs out of memory and crashes… 😃 )

---

<div class="post-metadata">

**Author:** ![gazpacho](https://avatars.discourse-cdn.com/v4/letter/g/6f9a4e/32.png) [@gazpacho](https://boards.straightdope.com/u/gazpacho)\
**Post date:** [June 14, 2006, 3:02am UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/23 "2006-06-14T03:02:32Z")

</div>

[QUOTE=Derleth]  
If any two components that communicate across an API can count as one program, then the largest program of all is the Internet.  
[/QUOTE]  
I have used that, it is sort of buggy.

---

<div class="post-metadata">

**Author:** ![psychonaut](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/psychonaut/32/4655_2.png) [@psychonaut](https://boards.straightdope.com/u/psychonaut)\
**Post date:** [June 14, 2006, 3:07pm UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/24 "2006-06-14T15:07:12Z")

</div>

[QUOTE=dotchan]  
Why would ya need to do that when all you need are a couple of nested loops? 😉

(Then eventually the computer runs out of memory and crashes… 😃 )  
[/QUOTE]  
A good optimizing compiler would probably replace a sequence of identical statements with a loop, so the computer wouldn’t run out of memory or crash trying to compile or run such a program.

---

<div class="post-metadata">

**Author:** ![Larry\_Mudd](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Larry\_Mudd](https://boards.straightdope.com/u/Larry_Mudd)\
**Post date:** [June 14, 2006, 3:10pm UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/25 "2006-06-14T15:10:42Z")

</div>

MS Hello World V2.0

---

<div class="post-metadata">

**Author:** ![Voyager](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/voyager/32/133_2.png) [@Voyager](https://boards.straightdope.com/u/Voyager)\
**Post date:** [June 14, 2006, 5:58pm UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/26 "2006-06-14T17:58:01Z")

</div>

[QUOTE=Derleth]  
Write a mathematical program in C and write something functionally equivalent in APL. Tell me that you still believe that SLOC is a good measure of complexity.

[/quote]

I agree it is a terrible one, but I wonder how many companies use it anyhow.

> [@](#):
>
> How about counting all of the Unix command line utilities (shells included) as one program and totting up the SLOC for all of that? That makes about as much sense as considering the Windows Vista kernel and all of its components as one program.

Well, Solaris (thought they didn’t say which version) was included on the list upthread, so that seems roughly equivalent to Windows. But I agree that how you define “program” is a bit fuzzy. If Firefox were in the running, would you count plug-ins or not? That’s a bit more reasonable than allowing anything that communicates through APIs. The compiler I wrote for my dissertation had a bunch of modules that communicated through files. (It was before the concept of API, and ran on Multics, and speed of coding let me get done faster and counted for a lot more than maintainability!) I’d call the whole thing one program - so that would open it up still further.

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [June 14, 2006, 7:43pm UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/27 "2006-06-14T19:43:41Z")

</div>

[QUOTE=Voyager]  
But I agree that how you define “program” is a bit fuzzy. If Firefox were in the running, would you count plug-ins or not? That’s a bit more reasonable than allowing anything that communicates through APIs.  
[/quote]  
But, you see, that is what they’re doing. Firefox and its plug-ins communicate through APIs, the various bits of Windows communicate through APIs, shell programs communicate through APIs, and my browser and the webserver on the SDMB servers communicate through APIs. How well-defined those APIs are varies, but once you get into that it’s an infinite regress of hair-splitting.

---

<div class="post-metadata">

**Author:** ![Gary\_Robson](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gary_robson/32/3448_2.png) [@Gary\_Robson](https://boards.straightdope.com/u/Gary_Robson)\
**Post date:** [June 14, 2006, 11:07pm UTC](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430/28 "2006-06-14T23:07:17Z")

</div>

[QUOTE=Emerald Hawk]  
Lines of code is a much better metric to use…  
[/QUOTE]  
I agree with **Derleth**. It’s a useless metric.

I can create a functional program that’s very UI-heavy in Visual Basic and only write a few lines of code. The same program in C on a Unix box where I’m writing each UI element could run into many thousands of lines of code.

When Martin Gardner wrote about John Conway’s cellular automaton game called [Life](http://www.bitstorm.org/gameoflife/) in _Scientific American_ magazine, a group of us thought it would be fun to see who could write the shortest program to run it. We defined the problem as a subroutine that accepted a matrix full of 1s and 0s to represent a single generation. Its output was a matrix representing the next generation, resized to have a single-cell border of zeros.

I don’t remember all of the exact numbers, but I do remember that the FORTRAN and COBOL versions were in the hundreds of lines. It was over a thousand lines in IBM/370 assembly language, and a hundred-something lines in BASIC. I got it down to a single line of code in APL (it was about 130 characters long). Others later produced a shorter single line of APL code.

We repeated this experiment in the late 90s and there was still an order of magnitude difference in number of lines between the verbose results in languages like Java and the results in dense languages like Perl.

Heck, even differences in programming style between two programmers writing in the same language can double or halve the number of lines of code (and it’s much more extreme in languages like Perl).

Any metric with a margin of error that big isn’t much of a metric.

[Previous page](https://boards.straightdope.com/t/what-is-the-biggest-program-ever-written/360430.md?page=1)
