When is it Best to Restart Your Code From Scratch?

0
12
Asked By CodingWizard42 On

I've been using Python to sync data between two different services at work through their APIs. While working on a large function for error checking, I realized after about 1.5 to 2 days that I had fundamentally messed up the logic. I could either continue forcing the problematic code or just start over. After deciding to start fresh, it took me about half a day to get the function working as intended from a blank document. This leads me to two questions: 1. What's the longest you've spent troubleshooting, only to redo the task in a fraction of the time? 2. How do you determine when it's time to throw your hands up and restart?

4 Answers

Answered By CodeCleaner55 On

If the code's mine, I have no issue starting over. I've dealt with inherited code that made no sense! In the past, I built massive modules for projects, and when things broke, fixing them became a long nightmare. Now I see the value in clean, modular coding—it just makes things easier down the line.

Answered By EngineerExtraordinaire On

I call that the 'engineer’s trap.' We get so caught up in making our current code work that we lose sight of the actual goal. I've had times where I've built something clever, but it was just a mess in the end. Now, I trust my instinct to know when I'm going in circles and might need to restart.

Answered By DataDiva99 On

I've found that stepping back and taking a real break can really help. Sometimes it's like you need a fresh set of eyes. And honestly, spending two whole days on one function seems excessive! It might be worth going back to square one if you're not making progress.

Answered By RefactorRanger On

I’m all for refactoring, and I’ve rewritten entire functions before, but I can’t say I’ve ever given up completely on something just to start over. It’s definitely easier to tackle issues with fresh ideas rather than scrapping everything.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.