I gave a short 30-minute demonstration of test-driven development earlier today in a tiny meeting room with almost no oxygen to a mixed audience of developers with backgrounds in various programming languages from C to C++ to some of those old proprietary state-machine based languages ending with "DL". Since my personal commercial experience in C and C++ (which seemed to have the biggest following in the room) is limited to some 3 weeks of fixing a couple of bugs in a home-grown PDF generator (populated with variables named "p", "p2", "pp", "k", and "j") while "the C guys" were on summer vacation and "the Java guy" was the only one with even the slightest chance of getting it fixed, I used my trusted companion Eclipse to show a bit of TDD live on the projector. In any case, it wasn't a problem since the process of test-driven development itself is language-agnostic (and assuming that you don't get stuck in trying to understand all the nuances of the code being shown on screen). It's the green bar and red bar that matter, and the notion of test code and production code.
Interestingly (or perhaps not so interestingly) one of the C++ guys said, instead of commenting on the TDD process itself, "Oh man, I want to do Java!", as he had watched me "CTRL-1", "CTRL-SPACE", "ALT-SHIFT-M", and "ALT-SHIFT-I" away with Eclipse.
And I agree. The tool support for TDD (or even unit testing in general) is apparently still pretty much non-existent in the C/C++ world. Yes, there are frameworks like CppUnit, CppUnitLite, CxxTest, CUnit, and so forth, but all of the frameworks this guy's team had tried had choked on some particulars of their system (don't know the details and quite possibly wouldn't understand them even if someone would try to explain since I'm really lost with my pointers). Pekka, who was also there to demo a functional testing framework mentioned a unit testing framework for C code named Check that might work. Or not. We'll see. Or they'll see, I should say, since I'm not in any way involved with that C++ project.
The same goes for refactoring--there's hardly any tools for C/C++ developers to aid them in that task, fundamental to keeping your codebase clean and tight.
This sort of encounters always remind me of how Giovanni has done refactoring on C++ code using shell scripts and regular expressions... (Much respect, brother!)







