Setting of the wrong path, on purpose

time to read 2 min | 379 words

That is how I built Rhino Mock 2.0.

I've a general idea about how I want it to look like, and I knew that I didn't like the current implementation. I wasn't very sure about how to go about implementing this, however. After my experiances with NQA, and after reading Working Effectively With Legacy Code, I knew that Test First is the way to go. So I started writing tests, and writing code to make them pass.

The part that I had a problem with was that I wrote code that I knew I was going to throw in a couple of hours / days, nevertheless, the tests require that it would give a complete solution to the problem. Then I added more functionality and I needed to rip apart the guts of the engine once more, and tottaly turn it around (from one mock at a time to managing several mocks at the same time.). Because I had the tests there, it took very little time to get back to where I was, and I'd the ground work to write more complicated tests.

Rhino Mocks 2.0 is feature complete starting from about 10 minutes ago, and all that remains is to switch NQA to the new version so I can dog food it properly. I expect to release it sometimes tonight. Here are some interesting statistics:

Total lines of code: 15,071 (Project) & 2,770 (Tests) = 17,841. Doesn't look too good, does it :-)

But: lines of code in the project, excluding generated strongly typed collections and xml comments: 1952 (Project) & 2382 (Tests)

So I actually have more code in the tests than in the code itself, which is what Test First should gives me. That was a very interesting experiment, btw, and quite a bit of fun.

"Your fault, core dumped." -- Tech Support Slogan
"IBM: Itty Bitty Mouse" -- Tech Support Slogan
"Out of my mind. Back in five minutes." -- Bumper Sticker

[Listening to: Jerusalem of Gold - Ofra Haza - Greatest Hits (disk 3)(05:47)]