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.
A style of programming originally influenced by:
1) assert(expression) c-language macros.
2) VERIFY(expression) style of coding in Microsoft Foundation Classes.
3) ThrowIfNil_(expression) style of coding in PowerPlant.
If employed rigorously, code becomes self-debugging and self-diagnosing. Or maybe you love a inscrutable stack trace from an NSException thrown deep from inside the unpacking of an NIB by NSCoder.
- COMPILE-TIME: ARC, pre-ARC, GCC 4.2, GCC 4.2 LLVM, 1.x LLVM and higher.
- RUN-TIME: Snow Leopard and higher, iOS 5.0 and higher.