Online example of TDD’ed code

Over the years, I’ve gotten a lot of requests for non-trivial examples of code entirely written using TDD and Simple Design. I can finally give you that example.

This code is for the Offline Application Block, part of Microsoft’s Smart Client initiative. Basically, it implements a framework that will allow client code to operate in much the same way, whether it is connected to the internet or not. It was written over a period of about 12 weeks, and was done entirely test first.

Due to legal restrictions, Microsoft is unable to release unit tests along with the application block, but the unit tests are available through the
GotDotNet Smart Client workspace
. You’ll have to join the workspace to see them, but if you want examples, it should be worth it.

I’d also welcome any kinds of questions about the design, the tests, or how the block was written.

— bab

It’s not about testing!!!

When you hear someone talking about Test Driven Development, what is the first thing that comes to mind? Is it “Gee, this sounds like a testing technique!”? If it is, you aren’t alone. Given that the first word of the phrase is Test, I guess you could be excused. But the startling fact is that Test Driven Development, or TDD for short, is not fundamentally about testing.

If Not Testing, Then What?

TDD is fundamentally a design technique. It’s really about thinking about the shape and feel of the class you’re writing right now, and trying to get the interface so that it feels right, based on what you know right now. There is no other time at which getting the interface right will cost less than it will right now, before there is any code holding you back, so you may as well spend a few minutes and think about the class you’re writing from the point of view of the users of your class. Later on, they’ll appreciate the time you’re taking now to make their lives better.

If you’d like an example of this, let me know. I’ll be happy to do it, and I’ll also know that someone is reading these rants 🙂

— bab

I guess I should introduce myself…

I’m Brian Button, and I own Agile Solutions Group. My 30-second elevator speech goes something like, “Agile Solutions Group works with small to medium size business and teams that creates software as part of their business, but not as their primary business function. I can show them how to build better, faster, stronger software using less time and fewer people, and creating the software with higher quality than anyone else in their industry. I can get their product to market faster, with higher quality than anyone else around.” I know, kind of lame, but I’m still working on it.

The speech above was my original business goal, but circumstances seem to have guided me somewhere else. Over the last 18 months or so, I’ve spent a lot of my time teaching Test Driven Development to well over 100 students, developing real-time C++ software for an embedded control system, and worked in the Patterns and Practices group at Microsoft. While I’ve enjoyed all of it, my time at P&P has been my favorite. I’ve always been a Linux bigot, but my opinion of the people working at MS has changed completely. I can honestly say that every single person I’ve met has been a pleasure to work with. They are, without fail, brilliant, and they get software.

In my 8 months there, I have had the pleasure of being solely responsible for the implementation of one of their great Application Blocks, the Smart-Client block. I learned a lot about the development culture in Patterns and Practices while building that block, and I hope also affected it towards a more agile culture at the same time. I do know that TDD is becoming a lot more acceptable and frequent in that group, and I’d like to think I had some part in that. Now I’m working on another block-related project that’s hush-hush, but I’m test-infecting them as well!

You can see more details about me on my web site, including my resume.

If you’ve actually read this, please drop me a note. I’d like to know that I’m not talking to myself…

— bab