Shakespeare’s sonnets have exactly 14 lines, his plays have usually around 2600 lines (Hamlet about 4000 lines). This is not that different from the few thousand lines of code a typical programmer writes for a unit, library or project, for example jQuery 1.2 and 1.3 have around 4000 LoC (jQuery 1.2.6: 3549 LoC, jQuery 1.3.2: 4376 LoC). It is well-known that progress and productivity cannot be measure in lines of code. Yet the order of magnitude is often quite similar in completely different projects and environments, because there is a limit what people can handle and produce.
The order of magnitude for the typical lines of code is as follows. A single programmer working a few days will usually produce some functions, methods and classes more or less rapidly, depending on his experience. If he is working a few months he will produce typically a few thousands lines of code. This is an amount a single person can still understand well, and it can still be customized and changed easily:
- function/method: 10 = 10^1 LoC/Method
- class: 100 = 10^2 LoC/Class
- library or small project: 1000 = 10^3 LoC/Project
A few programmers together working a few months will produce about 10^4 lines of code. This is an order of magnitude where it is becoming difficult for a single developer to understand and comprehend the complete code base if it is not well structured. According to DHH, Rails on Rails 2.3 has currently about 35.000 LoC (without tests and comments). A large framework requires about 10^5 lines of code. A complete operating system belongs to the largest software projects, it requires about 10^6 – 10^7 lines of code, Microsoft Windows 2000, Windows XP and early Debian Versions for example are said to have around 50.000.000 lines of code or ~5GB of data:
- a small framework or large application: 10.000 = 10^4 LoC/Framework
- ide/framework: 100.000 = 10^5 LoC/Framework
- operating system: 10.000.000 = 10^7 LoC/OS
For comparison only, a human has around 30,000 genes (~3.1B base pairs ~ 1.5GB). Modern versions of Debian Linux have up to 280.000.000 lines of code, see here. This is a tremendous amount of code which a single programmer can hardly handle anymore.