2/12/2017: TDD between layers

Civilians might want to sit this one out.

A long time ago, in a galaxy far far away I used to be an Extreme Programming coach. THAT didn’t work out. I just lock up when I’m presenting organized material for a crowd, which is odd really. I’ve got no trouble speaking in front of groups of people generally. When I was working with little teams of enthusiastic developers it was all good. I’d get involved in their project and we’d excitedly press forward.

When I had to hard-sell a room full of suits with their arms crossed over their chest, wearing their best scowls, well… I buckled. I’m much less worried about that than I used to be.

But one of the deep practices of Agile development/Extreme Programming is Test Driven Development. That’s where you don’t write a single line of code before you have a failing unit test. So you write the test, it fails, then you write the code that makes it pass.

It’s time consuming.


It’s slow.

But it produces better code than any other minute-to-minute technique I’ve ever used.

Still though, when you’re working on something in the small (like any of the examples they use in the hundreds of videos on the topic over on youtube) it’s lovely. You end up with a series of classes or functions that do exactly what the spec says they should, with a battery of unit tests covering 90+% of the code.

And all is right with the world.

I have a huge problem when I try to zoom out and write unit tests for larger and larger blocks of functionality. Yeah if I’m creating a little tiny thingie it’s no problem.

But developing test first and letting design emerge from the 15-30 second iterations starts producing insanity when I do it “in the large.”

So when I’m facing (as I am now) a new project that I want to run, fully tdd (determined to dust off my chops and do it right) I’m utterly flummoxed.

When I try to start from a higher level, the nature of tdd brings me instantly into this microcoding work style, which I suppose is appropriate, but I keep expecting the tunnel vision to abate and eventually to be testing larger and larger integrations of tiny code bits.

I’m gonna have to play around with it. Maybe I just need to start working from a “clouds on a whiteboard” design instead of letting it kind of….develop.

The biggest problem with a post like this (he realizes around word 430) is that I can’t give you a concrete example because this is a problem I’m having in the office and I can’t exactly post the damn code. Any contrived example I came up with would be sufficiently contrived that it would almost certainly not exhibit the problem I’m describing.

Yeah, sorry. No big conclusions or apostrophes (I think you mean epiphany) just something I’m trying to work my head through.

Leave a Reply

Your email address will not be published. Required fields are marked *