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 imagehelp@codebetter.com
Test First or Test Driven, Who Cares?

image This past weekend I attended the Continuous Improvement in Software Development Conference in Austin, Texas.  This conference brought together many brilliant minds in the .NET community for the expressed purpose of continuous improvement.  The conference was very good, but some of the best chances for learning happened outside the conference sessions at dinner or sitting around a table at the hotel bar.  One such discussion seemed to point out one problem we have in our community, minutiae.

I will preface the remainder of this post by saying I tend to be a purist at times and must always remind myself what the ultimate goal is.  Acknowledging my tunnel vision, sometimes purists, can miss the point if we're not careful.  One evening a few of us got on the discussion of test-driven development.  Someone at the table used the phrase test-first development in the conversation.  That person was quickly halted by others at the table because the terms, in their opinion are quite different and should not be used interchangeably.  If I were to ask you define both, could you adequately define the difference?  Should you be able to?  Does it really matter?

I would say that for the development community out there that the differences, if in fact they do exist, don't matter.  A quick and informal poll revealed that 8 of 10 developers I know aren't unit testing at all.  I readily admit that my sampling is probably an inaccurate representation of the total developer population.  I don't think though that my sample poll is off by an enormous amount.  Think of the developers you know; are they testing at all?  I'm not talking TDD, but plain old unit tests?  Chances are good that you know a few that aren't testing at all.  Are they served by the bantering back and forth about differences between TDD and TFD?  Absolutely not.

The important thing to remember is that fundamentally the TDD and the TFD practitioner believe the same thing, that is, you need to be testing your code. They may disagree about small things, but those small things should take a back seat to the fundamentals.  We don't have to look far to see another example of this type of behavior.  Think of two Christian denominations, both of which are trying to convert nonbelievers to Christianity, bickering among themselves about whether children should be baptized or not.  The debate becomes so ardent, that neither camp accomplishes their original goal or converting nonbelievers because they're too focused on each other.  I fear the same outcome will befall those of us preaching testing.  We get so religious about the non-essential aspects of testing that we miss the people we intended to target, the people who aren't testing their code at all.

I think we could all take a page from St. Augustine who had it right over 1600 years ago: "In essentials, unity; in non-essentials, liberty; in all things, charity."


Posted 11-03-2008 10:42 PM by Tim Barcz

[Advertisement]

Comments

Chad Myers wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 2:02 AM

Wow, a quote from St. Augustine... a man after my own heart (and brain)!

Agreed w/r/t minutiae. My advice (to myself and anyone else who might care): Get out there and try to get people testing. We tried to do that with PDoTDD. Arguing on the internet is stupid unless you're out there trying to do something about it.

And when I say "you", I mean anyone/everyone, not just Tim or Chad or the reader.

Derik Whittaker wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 6:25 AM

I could not agree more.  I know that i TRY to follow TDD most times, but often finding myself just covering my code in tests.

I understand the benefits of TDD, but not everyone else does (in terms of better, cleaner architecture) and because of this we (community, not people on this post) need to first  spread the gospel of tests, in any way the manifest themselves.

To me the most important thing is my code is covered under test.  That is it, plain and simple.

Dew Drop - November 4, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - November 4, 2008 | Alvin Ashcraft's Morning Dew
on 11-04-2008 8:09 AM

Pingback from  Dew Drop - November 4, 2008 | Alvin Ashcraft's Morning Dew

Dave Aronson wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 9:16 AM

I've come up with a brief-ish definition of TDD, as practiced by Andy Glover (who vetted the def while he was with Stelligent): "Ensure that your riskiest code, has adequate unit test coverage, within a reasonable amount of time, for values of 'riskiest', 'adequate', and 'reasonable', that fit your situation."

IMHO: "Riskiest" means "most complex, most essential to the intended purpose of the program, or most critical to get exactly right".  "Adequate" is a sliding scale depending on the risky-ness of the specific chunk of code.  "Reasonable" is even more subjective -- *preferably* before the code exists, but obviously that won't work with inherited testless code that you're trying to scaffold!

As for the rest of the code, that may be less risky: go ahead and write tests for it anyway, if you've got time.  Code that isn't complex, is often (though not always!) also simpler to write tests for....

Tim Barcz wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 9:32 AM

@Chad

I look at You and Jeremy as good examples of pragmatic developers.  In the session at Kaizen Conf on opinionated MVC you two were asked at various points questions that ultimately came back to purity in your design, areas where someone saw something that wasn't "pure".  Jeremy responded saying, "It hasn't bit us yet" or something to that affect.

I appreciated the candor and honesty, and quite frankly it was refreshing to hear.

Tim Barcz wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 9:35 AM

@Derik

I too TRY to follow TDD.  I think that people forget that TDD is hard in certain cases.  When not driving my design with tests I still want code coverage so I can come back an refactor later.  You can't refactor with confidence without proper test coverage.

"To me the most important thing is my code is covered under test.  That is it, plain and simple."

While others may disagree with you, where I am at in my developer journey, I could not agree with this more.

Scott wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 1:24 PM

This is what the "Developer Ubiquitous Language" session was about, and that conversation at the bar is exactly what sparked it.

Tim Barcz wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 1:30 PM

@Scott

What came out of that discussion?  Was there generally agreement or no?  Unfortunately I could not attend as I was convening another session.

Tim

Scott wrote re: Test First or Test Driven, Who Cares?
on 11-04-2008 1:36 PM

I'll do a blog post.  It diverted down a much wider path ultimately, but it was good.

People seem to not want to let go of their overloaded words and semantic pissing contests generally :(

Christopher Bennage wrote re: Test First or Test Driven, Who Cares?
on 11-05-2008 9:09 AM

I suspect that there may be some good Pascal quotes out there related to this. The distinction between TFD and TDD sounds like something from the Provincial Letters.

Personally, I adhere to the doctrines outlined by the First Church of ALT.NET as originally expressed by his grace Laribee. Ok, maybe that was a bit much. :-P

en.wikipedia.org/.../Lettres_Provinciales

Jacob wrote re: Test First or Test Driven, Who Cares?
on 11-05-2008 6:43 PM

If testing is truly what you want, you might want to switch your emphasis to *just* testing and drop the time element altogether. Almost everyone on the internet who talks about unit testing does so <a href="theruntime.com/.../tdd-considered-harmful.aspx">from a test-first perspective and/or with test-first assumptions</a>. That perspective can be daunting to someone who hasn't ever unit tested before.

If you really want to increase acceptance of unit testing, wouldn't it be better if you separated it entirely from the chronological axis? Small steps are a whole lot easier to take that big ones. How much easier is it to add a unit test project to your solution and start creating tests for those systems you consider most crucial than to train an entire team to write tests before writing any code at all?

Garry wrote re: Test First or Test Driven, Who Cares?
on 11-07-2008 5:26 AM

Jacob has a very interesting point.

<br/><br/>

'How much easier is it to add a unit test project to your solution and start creating tests for those systems you consider most crucial than to train an entire team to write tests before writing any code at all?'

<br/><br/>

I had the opportunity to refactor a great chunk of one of our in house applications last month. Before any refactorings, I introduced unit tests so that I could be sure that the code was still doing what I wanted it to do after the changes. This is an application that is mission critical to our business and I wanted to be very sure that I wasn't introducing any unknown defects in the code. These unit tests gave me great confidence. I will be working on another large project in the next month and now that I am more confident unit testing, my plan is to create the tests first. Maybe this is a better way of getting the 8 out of 10 developers to at least have a look at unit testing.

Tim Barcz wrote re: Test First or Test Driven, Who Cares?
on 11-07-2008 5:55 AM

@Jacob

I think you bring up a valid point.  I think writing unit tests before anything TDD is tough.  I'm doing a workshop this weekend on TDD and in this workshop we're going to write some code using TDD.  Will we get done in the alotted time?  Maybe, maybe not?  I don't really care.  I'm choosing to expose the attendees to real TDD, which went starting is difficult, rather than fly through some slides on a Power Point or show some already done code.

I think TDD is running while unit tests are walking and you know how the saying goes, you have to walk before you can run.

Jacob wrote re: Test First or Test Driven, Who Cares?
on 11-07-2008 1:17 PM

@Tim: Well, in a TDD workshop, I think it's safe to assume that people are ready to run. :). If I were attending, I'd MUCH prefer what you plan over a presentation-style structure. Particularly if you make good use of code snippets to make the boring structure bits go faster.

social bookmarks wrote re: Test First or Test Driven, Who Cares?
on 03-14-2013 2:51 PM

mlDo8o This is one awesome blog article.Really looking forward to read more. Fantastic.

buy social bookmarks wrote re: Test First or Test Driven, Who Cares?
on 03-23-2013 6:56 AM

9oJziR Great, thanks for sharing this article.Much thanks again. Really Great.

awesome moldavian news wrote re: Test First or Test Driven, Who Cares?
on 08-04-2013 6:50 PM

YVI2AP I really liked your blog post. Want more.

best linkbuilding wrote re: Test First or Test Driven, Who Cares?
on 09-30-2013 5:54 PM

xBYek0 Im thankful for the article.Really thank you! Great.

great link building wrote re: Test First or Test Driven, Who Cares?
on 11-21-2013 1:22 AM

XhFrh1 I think this is a real great blog.Thanks Again. Great.

awesome things! wrote re: Test First or Test Driven, Who Cares?
on 02-08-2014 12:56 AM

7zMcmB I really liked your blog post.Really looking forward to read more. Cool.

nice seo guys wrote re: Test First or Test Driven, Who Cares?
on 03-25-2014 8:48 PM

npavw9 I cannot thank you enough for the post. Fantastic.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)