It looks like a great addition. I'm at the Agile conference this week. Vacation next. I'll be looking at this more carefully after that.
I look forward to seeing you in Sept.
thanks, James
--------------------------------------------------------------------------------------------
James Grenning Author of TDD for Embedded C
www.renaissancesoftware.net http://pragprog.com/titles/jgade/
www.renaissancesoftware.net/blog
www.twitter.com/jwgrenning
Cell: +1 847-630-0998 Office: +1 847 438 9942
Uhm, I think it is a wrong assessment to say that the TDD community regards asserts (contracts) as a cover-up for bad design :)
Let me try to explain my perspective and also some background.
Terminology-wise, I'll still use assertion. An assertion is just a statement that must be true at that point in time. Design by contract is a technique (created by Bertrand Meyer) that looks at the caller-callee relationship as a formal contract (ignoring class invariants for now) and that makes the responsibilities between them very clear. These contracts, in C, can be enforced using assertions (statements that must be true).
I consider DbC extremely important. Not using this during design tend to lead to classes that either do way too much checking as it assumes an empty pre-condition or classes that do not checking at all as it assumes a strong post-condition. So, in designing interfaces, thinking using DbC is very important.
Before I wrote a lot of unit tests (10 years ago), I used a lot of C assertions to document the contracts and to ensure that the software doesn't break it. After I started test-driving my code, I don't add these assertions in the code anymore as I find them less needed. I clarify a lot of the contract by deciding what unit tests to write and these unit test also document the excepted behavior. I usually didn't find a need to still add these asserts and stopped writing them.
Now, you do make a good comment related to integration of features. Though, when I write unit tests, I try to get them to also test between classes, just making sure there are only 2 classes involved. Though, production-code asserts can certainly still be useful for that, though, as mentioned in the blog post, I often find them to clutter the code and rather not add them.
Just to be clear, I'm not saying that adding asserts to your production code is bad and evil and should never be done. Instead, I'm sharing that I personally tend to not do it anymore after moving to full TDD-style development. If other people find it useful, then please *do* keep using it. Also, I don't *never* use them, there are definitively situations where I would use them, though, not as frequent as in the past.
Also, I'll probably integrate the DbC TestPlugin in the CppUTest Extensions in the future (on my todo list) as it does seem to provide useful functionality and does promote good design.
Hope this makes it slightly clearer?
Thanks!
Bas