Hi!
I've been toying with a new project idea and have spent half a day doing exploratory programming to see how the different components would come together. I did cover a lot of ground, and in fact I'm probably going to pursue this project after a few more rounds of exploration.
This is in contrast to my usual workflow where I follow rigorous TDD. Now I find myself asking this question: when would be a good time to stop writing code, do some housekeeping, and start to build a test suite?
If you have had a similar experience before, I'm very curious on how you approached this scenario.
- Do you follow TDD, perhaps a lighter version, when exploring new ideas?
- If not, when do you start writing tests for the validated idea?
- Either way, at what point of these kinds of projects do you start configuring the "nice to haves" (linter config, coverage frameworks, pre-commit hooks etc)?
I'm really eager to hear your thoughts. Stay safe!
Top comments (4)
It all depends. I would categorize "exploring ideas" as "prototype-like code". If you spend time writing tests, just to delete all the code after, you might waste more time overall compared to not writing tests.
Thank you for your insight. I agree on all your points, perhaps this is just a matter of deciding when to pull the trigger. I guess I just get too attached to my prototypes. I have this habit of hacking on top of a working prototype until it's "good enough" when I should have extracted out the core logic and restart with a solid base.
Fair enough. I think restarting or refactoring the prototype code would work as long as the code quality is good in the end, whatever works for you. Since I like TDD a lot, just like you, I tend to restart. However, I keep the prototype code nearby for reference and / or even copy some parts of it.
Guilty of not doing that. 😰😄