It works both ways.
The reason I posted from the position I did is that too often in these discussions there is the assumption that the programmer understand the business well enough to make the call which in my experience is false.
The reality is that in these situations you have two people each of whom understand part of the problem. Simple black and white declarations of right or wrong by either party are unlikely to result in an optimal solution to the whole problem.
Really. It seems to me like everyone's there to make money for their departments / business units / lines of business.
In my experience, these requests that initially seem unreasonable will often have a very reasonable explanation. If you take the time to understand the motive, then will often be able to find some alternate solution that satisfies both the business and the developer needs.
What happens when you're not allowed to fix/improve/refactor the hack? Sometimes developers are assigned new tasks immediately.
If you come up against people who really just won't listen I tend to make a note of the fix, log it as a bug and include it in the next round of bug fixing, the next bit of quiet time or whatever. Alternatively include the refactoring into the estimate the next time I'd have to do significant work on that module.
Two other points while I'm rambling:
Always make sure that the refactoring is genuinely necessary and not just polishing. Some developers like "perfect" solutions but often this results in over engineering and significantly increased timescales. The key question I find useful is "am I coding for a specifically stated requirement or probable edge case or am I extrapolating to what I think might be useful / needed in the future?". I'm with Kent Beck on code only for what you specifically need today.
Secondly, only real issue with this approach I've outlined is if someone micromanages your time so heavily that you can't do any of that AND they won't listen to reason. In that instance you might want to consider your options but I've only ever once been in that position.
Never say, "You're lying" though. Instead say, "once burned, twice shy".
The promise that you'd get time to do the fix. Which didn't happen. That was how I read:
> > we'll do the quick hack, but only if we're then allowed, in the very short term, to make the fix properly.
>What happens when you're not allowed to fix/improve/refactor the hack? Sometimes developers are assigned new tasks immediately.
Yes too often developers are ridden over roughshod, but I think it's important to put the other side of things.
In the same way that person may not understand the consequences of the dirty hack, the developer frequently will not understand the consequences of delaying the change. Unless the developer can honestly say that they understand the relevant part of the business better than person making the request, some humility and willingness to compromise and discuss is likely to be appropriate.
For me the issue is not with doing the hack, it's getting the agreement that we'll do the quick hack, but only if we're then allowed, in the very short term, to make the fix properly.
That way everyone gets what they want - the fix is made in the timescales the business deem necessary and the developer isn't leaving a mess for future developers to have to clear up.
Being a professional programmer in a commercial environment isn't about sticking rigidly to some definition of what's "right" (which will often vary from one developer to another anyway), it's about using code to fix real problems and provide real benefits in ways which are appropriate to the situation and balance all the variables.
It's a variant of the old "good coders code, great coders ship". Being a great coder is about finding ways to meet everyone's needs.