This is a question that I often ask myself when working with developers. I've worked at four companies so far and I've become aware of a lack of attention to keeping code clean and dealing with technical debt that hinders future progress in a software app. For example, the first company I worked for had written a database from scratch rather than use something like MySQL and that created hell for the team when refactoring or extending the application. I've always tried to be honest and clear with my manager when he discusses projections, but management doesn't seem interested in fixing what's already there and it's horrible to see the impact it has on team morale.

What are your thoughts on the best way to tackle this problem?
What I've seen is people packing up and leaving. The company then becomes a revolving door with developers coming in and out and making the code worse. How do you communicate this to management to get them interested in sorting out technical debt?

When I met with my boss to discuss this, he said I should include refactoring in all my estimates.  He said it's not a problem he wants to think about.  Instead, I should handle it.

This isn't a problem that management in general wants to think about.  They aren't the engineers, you are.  Just make this an unspoken part of all of your estimates, and you'll find that the technical debt decreases.

It will never be perfect though.  Technical debt, like credit card debt, is an investment in getting customers faster and gaining market share over your competitors faster.  Like credit, if managed properly, it can make you quite successful.
