Throughout your career have you noticed any patterns in how much of the code you've written gets tossed? I am 2 YOE, so very junior, and I would say that probably 95% of the code I've written ends up getting tossed?
That said, this isn't to say that I write useless code, it's just that very few things I write are used for more than 1-2 months, at which point our team moves onto different things.
Curious if you've noticed less code being thrown away as you grow in your career, and if not, what the pattern has been for you.
On a long enough time horizon, 100% will be thrown away.
Practically speaking, it’s really hard to say. So much of my code is written as something useful that people ask for, then they never use it. So while it’s still out there and available for use (and works), it might as well be in the trash. I guess it’s a marketing problem, even though it’s internal code written for 1 team who specifically asked for it. Old habits of manual work die hard.Reply
I don't throw much away.
The code that does get thrown away tends to be an entire project at a time(I love to replace things with off the shelf), or when I replace custom stuff with libraries.
I almost never write simple throwaway scripts(Less than once a month).
On personal projects I do find that 95% gets discarded right in the trash in short order, although I've gotten a lot better at deciding what will be worth building before actually building it.Reply
Some of my code was written in 1995, and is still being used. I tend to toss my stuff that needs tossing before anyone else sees it. :)Reply
I wrote stuff in the 90s that's probably still in use. Conversely I have built who systems recently that have been superseded after a couple of months of use.Reply