Tuesday, June 24, 2008

Test Driven Development Training

I'm Test Driven Development (TDD) training today and tomorrow. TDD (sounds like a sexual transmitted disease) is where you write the test for a piece of code before you write the code. Seems pretty cool, though being a skeptic, I'll reserve full judgment until the project I'm working on is shipped.

5 comments:

RegGuy said...

In 1955. G.E. Morgan a consultant to Riddell, and Paul Brown the coach of the Cleveland Browns, invented the BT-5 face mask which is the single bar design. The year after the BT-5 a single wave radio was installed in a players helmet so the coach could give the play to the quarterback over a radio frequency. It only resulted in game time interference but the experiment was ahead of its time.

Scooter said...

Why a skeptic? Unit testing is pretty much defacto. Are you skeptical about using it before the code and then refactoring? I've been on a few projects with legacy code where you can see that model working, even though it wasn't called TDD. On my last big project, I'd write simple UI, and then write the middle tier code. Which seems incredibly backwards, until you just consider the UI test code. Give a demo, rewrite parts of the UI, run, fail, write new middle tier, run, succeed, refactor. Sounds suspiciously hacktastic, but worked very well. Of course, if you consider the UI production code - that model doesn't hold up so well because you don't really want to write a UI to handle the UI. But I've written the tests before the code for the middle tier with NUnit and JUnit as well. More than anything, it feels like another exercise in getting you stop doing what's rote - particularly some of the people heavy design meetings - and think about your code in a different way, and that's almost always a good thing.

Besides, you're a writer. One of the first rules according to many writers is "know your ending first". The tests are the ending, then you get to write the rest of the story and revise.

Mac Noland said...

Scooter, after finishing my second day of training and doing some real TDD, I actually really like the approach.

However, I'm still a skeptic. Why? Because management is pushing it, and you know how I feel about management ;)

Scooter said...

I was just in a meeting today where one of the Jeremys stated that he wrote unit tests, then appended, they're not in JUnit or anything like that, but they're tests. I felt slightly vindicated in my assertion that a UI could be used as a valid test.

Do you think your management issues stem from your Generation X distrust of institutions and/or authority in general?

Mac Noland said...

Scooter, my reasoning behind why so many of us (i.e. Generation X'ers) are skeptics is from increased education. I heard the CEO of IBM say once that along with a more educated workforce comes increased skepticism. I'm just trying to do my part.

I also think that the older you get, the more you realize things which you didn't think about as a young adult. I remember starting here as a 23-year-old kid. I thought anything management said was the gospel. Now after almost 10 years of work experience, I've come to the conclusion that we're often being led by people who know little, if any, more than we do.