There's a good balance of writing it right the first time, and spending too much time with the details and not the actual feature you're implementing.
With enough experience, you'll know how to start writing something such that it won't require extensive refactoring. Make sure it's good enough that if you don't have enough time, it's still good in these two major ways: as fast as possible with no redundancy, maintainable by someone else.
With enough experience, you'll know how to start writing something such that it won't require extensive refactoring. Make sure it's good enough that if you don't have enough time, it's still good in these two major ways: as fast as possible with no redundancy, maintainable by someone else.