Wednesday, October 07, 2009

Test First? Only if tests are the first and foremost deliverable...

Ok, given that my view on testing, unit tests, and "things of that nature" has slowly but surely evolved over time, I like reading what others have to say on subject. The only readings I steer clear of are fanboy articles, and possibly "it sucks because I'm contrarian" counterpoints. This still leaves lots of good material. For example, "Unit testing in Coders at Work" is a delightul compilation of multiple good (and some so-so) view points.

My personal favorite is the last episode: case of "a TDD proponent and another good programmer". Although it is but a single case I do think it suggests something simple yet fundamental: you tend to achieve whatever is your main goal. And if you consider Testing with capital T to be the most impotant thing; well, you will get good tests. But what does NOT follow is that you get stellar design or even code. You just get a design and an implementation that works the way you expected it to work. Which is not a bad thing per se; just not necessarily intrinsically good. That is: good design and implementation untested is better than perfectly tested but badly designed or implemented thing; it is easier to find implementation problems (bugs) than to re-design or re-implement.

That is probably my biggest misgiving regarding "Test First" idea: it does suggest that testing comes before anything else -- not just temporally, which may or may not make sense (often does; as often does not), but most importantly, as priority. For me testing is a very important supporting area: very useful (as I have said, none of my open source projects would have nearly as good quality and maintainability as they have without lots of time spent on writing and maintaining test code!), but ultimately not a goal but a tool to achieve the goals.

With respect to article, another pleasant observation is that I tend to agree with most practicioners interviewed. Pragmatism seems to be a core trait of good programmers: if not a defining one, at least one strongly correlated with core competencies. I suspect that has lots to do with the failure of the "TDD guy" on his try with Sudoku solving, as well as misplaced (if understandable, considering he was writing material for his blog) focus on testing.

blog comments powered by Disqus

Sponsored By


Related Blogs

(by Author (topics))

Powered By

About me

  • I am known as Cowtowncoder
  • Contact me at@yahoo.com
Check my profile to learn more.