Thursday, February 27, 2014

Test Driven Development

Introduction

In following an online tutorial about Rails development, I have come across an interesting idea that Dave seemed to be introducing us to in 351. This idea is development based on testing small junks of code and getting them to function. The term test driven development or TDD as chapter 3 of the tutorial refers to it is the idea that the developer writes tests that initially fail, then implementing the functionality, and getting the code to pass the tests. This cycle can be thought of as
 fail->implement->pass. Trent had also talked about developing in a similar fashion and David Lochridge talked about developing in this way on the final project in 351. I also image Justin Edwards thinks about development in a similar way based on the fact that he and David work together. Either way, considering that Dave and my entire team, all of whom I respect very much in terms of development abilities, have discussed this topic in some form or another, I am inclined to "drink the cool-aide" of TDD for this project.

Cons

I can't imagine this way of development having many flaws. The only one I can think of so far is that it leaves the programmer with a sense that not much is actually getting done since they are focused on writing tests instead of seeing any real behavior.

Pros

It forces the programmer to think about exactly what the behavior and output of the function should be and then commits them to implementing that behavior to achieve the desired output until the test goes from failing to passing.

Conclusion

I would be sold on TDD based on how many times I have heard the term used and the number of people I've worked with use it. From my perspective though, its even more valuable because it forces me to think about what I want the user of our application to see, then forces me to implement the behavior that would achieve the desired results. I image this being a useful tool in increasing my productivity as a developer and ultimately paying off by having a well designed and tested application by the end of the project. Pretty Sweet!

No comments:

Post a Comment