Derik Whittaker



Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at
They all have one thing in common.....

Test first

Test during

Test after

Answer, Test.

No matter what style of testing you believe in, they all share one common trait.  They all test your code. 

So, what is the point of this post you may ask?  Simple.  To me, it does not matter how your tests come to be, but having tests is what is important.

***** Yes, I know that the TDD purest believe that testing first provides simpler code, cleaner code, better SoC, etc, etc.  *****

Till next time,

Posted 03-18-2008 6:07 PM by Derik Whittaker
Filed under: , ,



AndyB wrote re: They all have one thing in common.....
on 03-19-2008 9:15 AM


following on from your last post, where you friend (I'm hoping not your colleague ;-) tests are better than no tests - absolutely.

Not sure how tests ensures cleaner code though.  It may 'encourage'  refactoring, but it certainly doesn't 'enforce' it.

As a TDD'er though, I would say that doing the tests first gives you more than SoC.   It helps you design by defining your interfaces.

Just my two pence worth.

Derik Whittaker wrote re: They all have one thing in common.....
on 03-19-2008 9:26 AM


You are 100% correct about TDD doing more then providing SoC, I decidedly did NOT going into detailed benefits of TDD in this post as it was not the point of the post.

Wojciech Gebczyk wrote re: They all have one thing in common.....
on 03-19-2008 9:34 AM

I agree with Derik - do tests in a way that you like, don't follow purists adviced if you are not comfortable with them.

AndyB - I see that you are closer to tdd zealots. If you saying "interfaces" means API then it is partially true. But only when you drop typical test writing. When you are writing only those blessed multiple small tests then benefits for API are rather poor. If you break the rule of small tests ONLY and start writing larger  (possibly redundant) tests then you API "design" can have benefits from it. But then you are outside of the Right Way of TDD.

Good API design comes from "code/class" interaction then from working code.

Peter Ritchie wrote re: They all have one thing in common.....
on 03-19-2008 9:42 AM

My experience isn't that testing encourages or enforces re-factoring--it just ensures the current level of quality despite of re-factoring.

TDD "mandates" test first, but it doesn't preclude testing (in all forms) throughout the rest of the life-cycle, which is what Derik is saying.

I think many people are doing themselves a disservice in that they're testing efforts are the only place they're implementing SoC, IoC, etc...

Ilja Preuß wrote re: They all have one thing in common.....
on 03-26-2008 3:02 PM

There was an interesting lightning talk by Johannes Link (a well known Agile coach here in Germany) at last years XP Days Germany. He reported that he could classify the  teams he had coached and came back to after a few weeks into two classes:

One that had code coverage of over 80% and the whole team writing tests.

The other had only a few developers writing tests, code coverage being around 50%.

Now the interesting part is that he said that those two different results closely correlated to whether the team had adopted a test first approach or was writing tests after the production code.

This is consistent with my own observation that writing tests first is actually much easier - and more importantly much more *fun* - than writing tests after the fact.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)