The number one most important thing you can do in software development. Always leave the code base cleaner than when you found it. Always aim to improve things.
I recently stumbled on a fantastic podcast by Joshua Wulf featuring Damian Maclennan who brilliantly described why this is so important.
If you see a professional chef vs. a home cook, they enjoy cooking, but they end up with a mess all over the kitchen bench, but if you watch a professional work they'll chop something and then they'll wipe the board down, do something else and clean up a little bit. All along the way they're cleaning up. So they never get this massive build up of crap. Because once you've got that build up of crap you can't move. You end up with this tiny five by five centimeter square of space and you need to chop an onion and all of a sudden onion is going everywhere. That's what software development can be like, that's what code bases get like. You need to clean as you go.
You need to always take that professional mindset. A lot of companies think there's no time to do that. You just need to smash out features, and then you get to the point where people go to their manager and say we've got all this technical debt we need to stop what we're doing and fix our technical debt. And the managers kind of hit the roof over that. We're under all this pressure. I've heard people give these excuses; there's never any time to do it right. But if you go into a hospital they're generally fairly slammed for time as well but you would never see a surgeon say "you know I really should wash my hands but I'm kind of busy, there's no time". They just do it. It's part of their professional ethics to do it. To use hygiene and do things right. And again you'll get fired as a chef if you're not fast enough because you don't clean as you go. But in software it's kind of this top down beat people with a stick approach telling them to go faster and then you wondering why you end up with a mess.
Good software development teams clean as they go and the developers understand their professional responsibilities. You have to keep on eye on the future, on the impacts your decisions today will have. And it doesn't have to be at the expense of the short term. In fact, the future is often closer that it appears. Cleaning up as you go and doing things right can help you as soon as tomorrow. Now don't get me wrong, these aren't rules that apply to all code, we still have throwaways and prototypes. There are still trade-offs to make. But the baseline is set. If you're not cleaning as you go, it's slowing you down.