It is all about perspective:
- You saved the day and you are a Hero by fixing the product
- You left around messy unclean code and you are lousy developer
I think your are both right, congrats! Cleaning time...
You have a piece of functionality that you need to add to your system. You see two ways to do it, one is quick to do but is messy - you are sure that it will make further changes harder in the future. The other results in a cleaner design, but will take longer to put in place.
Technical Debt is a wonderful metaphor developed by Ward Cunningham to help us think about this problem. In this metaphor, doing things the quick and dirty way sets us up with a technical debt, which is similar to a financial debt. Like a financial debt, the technical debt incurs interest
Who is going to repay the technical-debt you left behind? Even if you did it to the best you could, others seem to think you rushed and left a lot of technical-debt.
Every project has maintenance even non-critical websites. Therefor someone should estimate if keep cleaning is worth it. You made the call and others are challenging you on it. Don't feel bad, even if you don't 100% agree you could say it wasn't your call and you should have notified someone to make the call on leaving the errors and messy patches. Make friends, find the win-win and fix the code if needed.
There is no canonical answer here so this question I think is out of bounds for this site. However, I like it. Here are my thoughts:
Both of you are right. Your story suggests that you exhibited heroics to get the job done to the satisfaction of your customer. It appears heroics were needed for this project at this time. So from that perspective, you should have been commended for your efforts.
However, heroics are unpredictable in its outcomes. Mature operations and projects do not need or want heroics because of this unpredictability and downstream effects. Think about NASA. Think about Apollo 13. Heroics were necessary to get that craft back to the ground safely and there were many heros then; however, NASA does everything it can to avoid the need for heroics, in terms of planning, risk management, tons of controls and checks and balances, testing, and on and on.
What your company is doing wrong is looking to find blame and it appears it's you. They should be conducting a lessons learned analysis to find out why they ended up in a situation where heroics were necessary and figure out how to avoid them in the future while thanking you for your efforts.
This is completely my opinion.