It depends on the code's lifespan and blast radius. Clean code pays off handsomely for code that lives and changes; "good enough" is the right call for throwaway, prototype, or rarely-touched code. The skill is matching your investment to the situation — avoiding both sloppiness and gold-plating.
The principle: match effort to the code's life
Code quality is an , and like any investment its return depends on time and exposure. The two questions to ask:
