Musings on Refactoring as Waste - The Code Whisperer

How much time should one spend thinking, planning, and designing before "Getting it right first time"? :-/