Dr Herbie said:
Most of the code I write, I'm not proud of; it gets the job done and it's (relatively) defect free, but the system I work with is close to being a big ball of mud. It's very hard to write elegant code when most of what you do is making changes to a BBoM under time pressure.
That said, I have started to spend a bit more time implementing the "Boy Scout Principle" to make minor improvements to any code I touch.
My main frustration at the moment is wanting to re-architect code for which there is no real business case to re-architect.
I used to try and do that, but the development environment we work in actively encourages writing it correctly the first time and not 'refactoring' it later. I've been the evil-doer in a few situations where I've refactored and ended up causing problems.
Because the original code was wrong and the code that depended on it enjoyed the excentric fruits of that bad code.
Now, I do my damndest to write good code from the start, and I code-review the hell out of every bit of code I have a chance to, but once the code is 'released', I have to suck it up and accept that it is what it is.
I equate it to being OCD and being unable to wash my hands