Objective-C 2.0 (minimum) Structured Programming with Invariant Requirements (Bertrand Meyer's PRECONDITIONS).
The basic premise of WithRequirements is that traditional assertions, including assert(exp) and NSAssert() create fragile systems. The goal of WithRequirements is to replace fragile assertions with resilient preconditions. Some failed assertions result from temporary runtime conditions. Stopping the execution of a program might be fine for a CompSci 101 student project or a Cordoba craplication, but it doesn't really cut it for well designed software. Well-designed, resilient software should flex and bend under exceptional circumstances, but it should not break.
Return value propagation isn't going anywhere soon. This methodology should be suitable for everything from kext development to daemons to userland.
A style of programming originally influenced by:
assert(expression) c-language macros.
VERIFY(expression) style of coding in Microsoft Foundation Classes.
ThrowIfNil_(expression) style of coding in PowerPlant.
If employed rigorously, code becomes self-debugging and self-diagnosing. Or maybe you love the smell of an inscrutable stack trace emitted from an NSException thrown deep from inside the unpacking of an NIB by NSCoder. I know I don't...
- COMPILE-TIME: ARC, MRR, GCC 4.2, GCC 4.2 LLVM, 1.x LLVM and higher.
- RUN-TIME: Snow Leopard and higher, iOS 5.0 and higher.