Cumartesi, Aralık 24, 2005

Test Driven Development vs. Test First Development

Geçen hafta bizim projede de Test Driven Developmentla ilgili bir tartışma çıktı. TDD'ye göre önce test sonra kod yazılması kural olmalı mı, olmamalı mı? Önce test yazılmasının avantajları var, şüphesiz. Ancak her zaman bunu yapmak da kolay olmuyor. Özellikle derin dizayn veya algoritma gerektiren problemler için, unit testten başlayarak yazmak, benim kendi deneyimlerime göre, biraz zorlayıcı oluyordu. Biraz önce Dave Thomas'ın (benim herhalde en çok alıntıladığım yazar :)) bir röportajını okuyordum. Bu tartışmayı güzel bir şekilde ele almış:

"I believe in test-first development in that I know it exists and therefore, I have to believe in it. I don't necessarily believe you have to follow it. I very much believe in test-driven development and the two are often confused. People tend to talk about TDD and test-first development in the same breath, but they are different. Test-first development says you can't write a line of code until you've got a failing test and that's all right, that's cool, but the more important thing is to say, "I want the tests to drive the design of my application." "I am going to listen to unit tests and I am going to use those to say if my design is incorrect" because a lot of the benefit of testing is not the actual running tests, it's the way it influences the design of your program. ..." Devamı için: http://www.theserverside.com/talks/videos/DaveThomas/interview.tss?bandwidth=dsl

Hiç yorum yok: