This question already has an answer here:
On one hand, I have been taught by various software engineering books ( as example) that my job as a programmer is to make the best possible software: great design, flexibility, to be easily maintained etc.
One the other hand although I realize that I actually write software for money and not for entertainment, although is very nice to write good code and plan ahead and refactor after writing and ... I wonder if it is always best for the business (after all we should be responsible). Is the business always benefiting from a best code? Maybe I'm over-engineering something, and it's not always useful?
So how should I know when to stop in the process to achieving the best possible code? I am sure that experience is something that makes a difference here, but I believe this cannot be the only answer.
 Uncle Bob's in Clean Code says at page 6 about the fact that:
They [managers] may defend the schedule and requirements with passion; but that’s their job. It’s your job to defend the code with equal passion.