TDD and SharePoint is it worth doing?
Just read a post by Sahil Malik where he gives his reasons for saying
TDD + SharePoint 2007? Well – screw it! Not worth it IMO.
The reason for his statement is that he sees the actual C# code developed as being a very small % of the total SharePoint project and the effort to do this as not worth the return when you consider the project costs overall.
The problem is, like so many people, he is getting TDD mixed up with doing good development. He dismisses TDD because it is harder to do in SharePoint because of the API. It’s not TDD that makes it harder, it being able to isolate the API and design testable code that is harder.
If you listened to the SharePoint Podshow I did with Eric Shupps we were in agreement that what actually mattered was that you developed good quality code, that you had the processes in place to enable code reviews, unit testing, integration testing, and the like, that all go together to ensure the code you do develop for your SharePoint solutions is Enterprise ready.
I hold my hands up, I do talks on TDD and SharePoint. I don’t do this because I think that everyone should do this on day one, I do it because people have used SharePoint as an excuse to not doing quality development. The comment ‘we can’t do unit testing because we are using SharePoint’ has been common among development teams, other just don’t do unit testing anyway so it never even cropped up. So if I can demonstrate the you can go all the way and actually code your solution using a technique like TDD then this argument no longer holds water.
What the question should be
Quality Development and SharePoint, is it worth doing?
And the answer to that is a big Hell Yes!
And if your happen to use TDD to write some of that quality code, then that’s good too.
The key thing to remember is that you need to make a judgement call about the value; in Sahil’s defence he did mention this. What I can’t take is that he adopts the ’screw it’ stance before he even starts. This to me is a much of a problem as the people at the other end of the spectrum that think you can ONLY code using TDD.
