May 21, 2009

Learning to design with TDD

This stems from a post Nitish wrote about TDD (Test Driven Development) and how developers end up making a sales pitch to their managers for using the methodology.
While discussing the same, we travelled on a tangent (not so far away) viz., what is the prime objective of TDD and are all/most
developers who practise (or try to) it, able to achieve it.
We converged that the true objective of TDD is to arrive at a good robust design that the code in question runs on. As a beneficial
side-effect, you get code that the QA team strugles to look down upon and you end up spending lesser time debugging it -
to arrive at a tangible comparison that must lead to this conclusion deserves a separate discussion (post).Well, truth be told, if we look at the context of the internet, where the LAMP stack has made it so convenient to build websites
that programmers (?) exploit the supreme forgiving nature of the PHP platform to the hilt. Good modelling, robust design and
architecture are milestones that are too far in the future.
So as a coder, I know about OOPs and abstraction to implementation as much as a few key books in college could engage me to read.
But that's just about it. In India at least the schools don't really teach you designing models and approaches.
That begs the question : can practising TDD help bridge this gap ?
Playing with some code and tests with the help of Eclipse pointed the needle to Yes ! But that's java - a language whose developers
are pampered with a number of high quality tools that make it so much fun and so smooth.
If you talk about PHP - the poor Rolex (Eclipse/Junit) replicas like SimpleTest and PHPUnit leave a lot to be desired.
But The possibility of these tools aiding developers ignorant to design pracices, learn by doing, is not bleak at all.
Soon, would be experimenting that and see if the hypothesis is correct.

1 comment:

Nimish V Adani said...

Interesting stuff. Vibhore, you should be blogging more often. Am sure there's a large audience out there who'd gain from it.