anonymous tech woman

Yet another woman in technology blog. I'm actually a developer who uses a variety of Java and database technologies on a variety of platforms.

Tuesday, September 05, 2006

Test Driven Development

The entire point of test driven development is that you write your tests first and then your code. You continue refractoring your code until they pass the tests and then if you change anything in your code a few days, months or years down the line you run the tests again and your code should pass. This is the main philosophies of most agile methods however even if you are not using such a methodology it is good to do.

I use JUnit because I mainly develop in Java. Using JUnit or a similar test API at first may seem a bit tricky i.e. if your method has no return type how do you check that it is doing what you think, but you soon quickly get use to developing in this manner and find that it is actually quicker because you have to have a clear idea of what the purpose of each method is before you write it.

(By the way if your method has no return type you just have to check on the objects that the method has changed before and after your method call. If you can't do that then use the java.lang.reflect package.)

Technorati Tags: Java, Test Driven Development, JUnit


Post a Comment

<< Home