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.
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.
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.