3 ms·
I agree that TDD isn't great if you're just exploring a problem domain. For that, I use spike solutions (throw-away standalone programs). But I've also noticed
by jdlshore 13y ago
I agree that TDD isn't great if you're just exploring a problem domain. For that, I use spike solutions (throw-away standalone programs).
But I've also noticed that a lot of people seem to use a very verbose, mock-centric approach to TDD. That approach isn't amenable to refactoring because anything more substantial than "rename" or "extract method" changes details that the tests depends on. If you're finding it difficult to change your code once it has tests, it might have something to do with the way you're writing your tests.
- moron4hire 13y agoYeah, the key is interface testing. I have a MUD that I'm writing right now with which I fell into an overly verbose TDD trap recently. Originally, I had a script that ran an AI character through a number of actions executed via the same series of commands that a user would use, then checked the results also through the same series of commands that a user would use, and that worked great. But then I started down this road of thinking, "I never even had my own code! Look at me, granny coding, not unit testing like I should." And started down this boondoggle path of writing a few kilolines of test code. Long story short, most of what I ended up writing was completely useless. The most important feature of testing is coverage, to have a way to hit every corner of the code to validate that it's all still "not failing", NOT to verify that the design is behaving lock-step as planned. Which is very important in this case because the game is being written in JavaScript, thus there is no static compile-time checking.