On my post STOP() Happens Geoff posted an interesting link of DAB wrote on “Offensive Programming”.
An offensive routine is different. It should have a tightly defined specification of what it does and it should assume that the input parameters are correct and valid (this eliminates flab and rarely entered code-lines from the library routine). However a properly offensive routine should not just assume it is called properly but also insist. The ASSERT clause allows just this…
If you scan the ABC libraries you will find asserts used liberally (they are free when debug is off). They are used to check references aren’t null, parameters are in range, boundary conditions are bet, queues contain expected values. In fact just about anywhere we thought ‘this is bound to be true’ we assert it.
I’m not sure “liberally asserting everything” works well with shipping Debug builds. I do that because the Exception window with the Debug DLL Call Stack is so useful. There is also the Capesoft GPF Reporter which requires a Debug build. ASSERT can he hooked so that you could only show it when running “In House” or other criteria e.g. file name AB*.
I was curious how common it was to ship Debug? I allowed an option that maybe you have special “Debug Beta” builds which implies Gold ships as a Release build.
- Debug Build
- Debug Betas
- Release Build