HACKER Q&A
📣 m33k44

I Am Going in Circles


I am writing a piece of code for a web application. After deliberating on an approach I implement it. Then after I complete the code, I think of another approach and abandon the previous code and start writing new one! This has happened now for almost two weeks. I complete the piece of code, I am not happy with it. Then throw it away and start deliberating on a new approach and the cycle starts again. I am just going in circles! Looks like I am stuck. How to get out of this situation?


  👤 injb Accepted Answer ✓
Why do you throw the code away? Does it work?

If YES, stop throwing it away.

If NO, then you are not finished figuring the problem out. Keep iterating. The first time you write something that works, start working on another feature.

Once you're working on another feature, you have a choice to either abandon something that is not working yet in order to refactor something that already works, or keep going on the new feature and leave the old one alone. That should be an easy choice ;)


👤 PragmaticPulp
It’s important to learn the difference between getting a job done and writing perfect code.

Engineering is largely about creating solutions that satisfy the requirements. Perfectly crafted code isn’t a requirement. As long as the code works, is maintainable, and is commented appropriately then you’re done.