Disciplin
Test-driven development is a really wonderful idea. Start doing it and you'll catch the fever. There are many sources that establish all the benefits of this approach. However, we're still human people,...
I personaly find it difficult to do pure test-driven development when:
- In the process of implementing necessary code to make one test pass, I have to write new code in other classes that should also be tested. Sometimes, I am so much into getting that green bar, that it's not so easy to digress and start fully testing/developing something else
- When I develop a new idea, a new implementation across a whole set of classes, I may want to write code that could end up not being the right approach for my current objective. Should I then write the tests for something that may really not function as planned and that should be thrown away?
- Set aside my first testing goal, clarify what I expect of each new operation I am developing and test it, even if it may cause a delay for the first green bar, or for the exploratory design
...to always have a tasks list for the things that should be tested:
- Once you have the first green bar, go back to the list and test everything that hasn't been tested
- Ditto for the exploratory design
"Ok, ok, Eric, it's nice to learn about your fascinating worklife, but what's the point?".
Well, the point is that one: in order to succeed, you need disciplin.
You absolutely need to get back to your list. I found that 2 nice ways to do that:
- Use your buddy! When you practise pair-programming, your partner should always have the responsability for the tasks list. He is your Master that should help you with the disciplin stuff (this also goes for coding standards respect and so on)
- If you program with Eclipse, you could use Mylar. This plugin keeps track of all the classes that you modified in the context of programming a given feature. That way, when you get your green bar, you can be confident that you got all the modified resources at hand.
No comments:
Post a Comment