Hacker News new | ask | show | jobs
by mupuff1234 955 days ago
I wonder what's the median life expectancy of a piece of code.
5 comments

At least for my own code, I'm pretty sure its an inverse relationship to quality.

The masterpiece I fretted over for endless hours is guaranteed to be obsolete within 1 year.

The crappy hack with the comment that says "@TODO make not be garbage sorry" is cursed to live on for eternity.

Only the good die young
It varies pretty wildly but in my career a lot of code has lasted over 10 years and in some cases over 20. Also because code is sort infinitely copyable some code just keeps moving from product to product. Or some design moves from product to product. The longer you work in programming the more you have a set of tools that you can reach for over and over even if you're effectively writing it from scratch each time.

I think good code is vital to the software development process. It doesn't have to start out good but it should end good. Because you're going to be back at this code over and over. A little bit of effort up front can save you a lot of time in the long term.

Hard to know. I know there's plenty of code that never gets into production. Otoh there's code I wrote in 1996 that's still in widespread use.
Two years, maybe.
The worse it is, the longer it will linger.