3 ms·
Bit OT but TDD works great where you have the specs for your project down to a T, but sometimes you're working on a website or project in which you have an end
by superasn 10y ago
Bit OT but TDD works great where you have the specs for your project down to a T, but sometimes you're working on a website or project in which you have an end goal and some fair idea of what you're making but not everything is concrete and in such scenarios doing TDD can waste a lot of time (at least it did for me).
For such projects at least for my own case I have seen that an Excel driven development (Yes i just made it up) is a really good idea. Instead of writing tests and creating mocks and doing a lot of legwork I just write the function name in an Excel file, with the constraints and output in columns. Hardly takes me 1 minute since I always have the .xls file open. Then I go into a free-flying mode, creating my function and code and never think about it until the project is finally complete. I of course am mindful that I will have to write tests for it later so I do use DI and staw away from Singletons, etc.
Then when everything is ready (think v0.01), then I go back to each function in the XL file, and write a test for it creating assertions using the constraints and output I jotted down earlier. This way I'm not writing or re-writing my tests because something I hoped to use in my project has changed during the course of development.
After that it is TDD only because the v0.01 is out and now I have to careful that any changes I make don't break anything. I don't think this would work for a corporate environment but for solopreneurs and not so serious projects this can really be helpful. It does seem to work for me at least.
- lgunsch 10y agoTDD is designed for exactly the opposite. If you have a really good understanding of problem and solution from experience, then just go ahead and do it. Kent Beck talks about this in his book "Test Driven Development by Example". TDD does best when you need to be able to respond quickly to new knowledge as you dive into the problem domain or make changes due to migrating business requirements. TDD lets you create your abstractions using concrete evidence, instead of trying to guess. However, I have found TDD to be a difficult skill to master. You cannot just try it out for 6 months and expect to be quicker using TDD than you are without it. Until you have a bunch of experience built up in TDD, it will slow you down a great deal - which is what you may have experienced. It took me about 18 months of continuously using TDD daily to really get a solid grasp of TDD.
- ereyes01 10y agoI second this... TDD is a craft and is hard to master. IMO, that's a direct consequence of software being difficult to write correctly in general. It also took me about 18 months to build up a good level of confidence and speed with TDD. I found it to be a really rewarding experience.