http://www.perlmonks.org?node_id=533135


in reply to what to do when you screw-up?

The best course of action depends on why your simple and straight forward program ballooned into an unmanageable monstrosity. Is it because you misunderstood the requirements when you started it? Is it because people wanted more features after they saw what you could do? Is it because you underestimated the complexity of the legacy code? Is it because the legacy code doesn't work as documented?

To move forward, you need to fix whatever problem caused you to get into the situation to begin with. Once that problem is fixed, look at what code you've got now, and decide what needs to be done to get it where you want it.
It doesn't matter who’s fault it is. Everyone makes mistakes, and as long as people aren't repeating the same mistake, going around placing blame is just a waste of effort.



Regarding rewriting at home, I assume you mean your rewriting on your own time. Ultimately, the program belongs to the company, so even if you screwed up when you made it, its still their mess. If the program is going to be of value to the company, they should pay to fixed it. If its not going to be of value, they should scrap it.

I know the feeling of wanting to be proud of your pet projects, but sometimes they just need to be scraped. If you offer to fix it for free, the value to the company no longer enters into the equation, so you might just be wasting your time on something that isn't really all that important anyway.