is it not necessary to be checking whether the values of data objects will be in a consistent state even during release code? or in that case will you change these assertions in the model to exceptions in the controller or something like that?
this was one example i read in this article , the prequel to the earlier article i posted on assertions. it explains more on the implementation of assert in java.
the part i wanted to draw attention to is how to remove assertion code from your class (maybe for not so professional release builds!!)
" The assertion facility does not provide a direct means of conditionally preventing the inclusion of assertion code in a class file. The Java Language Specification, however, provides a standard idiom for achieving conditional compilation in Java. Applied to assertions, the idiom looks something like this:
static final boolean assertionsEnabled =
if( assertionsEnabled )
Since the variable assertionsEnabled is static final, when the value is false, a compiler can detect that the assert statement is unreachable and can remove the assert statement code. "