The oldest piece of code turns 70 today. It was written by Tom Kilburn and it first ran on 21 June 1948 on the Manchester Baby. Kilburn's code returned the highest divisor of 218 by testing the different possible solutions one at a time starting from 218 - 1.
We still have that piece of code. And it's still running. But it's running in a museum. It's memorabilia, not production code. It pretty much did all it could do the first time it ran.
The life of Kilburn's code does not look like the life of average code. Kilburn's historical code might run for another 70 years while your code is going to be forgotten and buried.
Should this be something you need to think about more?
Brewster Kahle of the Internet Archive has said, “Pretty much all the software ever written is just gone.”
Bob Frankston, the co-creator of the first spreadsheet program, says that when we are trying to reuse large amounts of existing code we are basically just “picking off sentences from other people’s stories and trying to make a magazine article.”
If that’s true, then do you really need to refactor that piece of code right now? Do you need to get a feature into production or do you need to write a fancy module?
When Rob Pike (one of the people behind Go programming language) joined Google he was told that even a single line of code that could have been avoided with an additional dependency was inefficient. Pike says that Google is still suffering from that former way of thinking in terms of code maintainability and complexity.
If that’s true, then why do you feel like a fraud when you copy-paste some code from a GitHub repository instead of including a Node.js package, a Ruby gem or some other library? Why are you extracting logic and DRYing up your code when you could simply copy-paste a line of code from one place to another?
Your code is not immortal. It’s not a cave painting. It’s not a novel. There is no legacy for the future generations in your for-loop. The next time you open your laptop maybe realign your focus differently.
Live fast and die young, dear code.