Robert

56%
Flag icon
An important exception is the case in which the validity check would be expensive or impractical and the check is performed implicitly in the process of doing the computation.
Robert
I have a recommended exception that I like to call "garbage-in-garbage out micro-optimization." If the check 1. Checks for programmer error (as opposed to input/user error) that is moderately expensive to check, 2. and is therefore expected to almost never happen in production, and 3. Letting it be thrown during computation would not leave the object in an inconsistent state, then It's better to not check in advance. Don't let protecting programmers from bad code compromise the good code that will happen most of the time.
Effective Java
Rate this book
Clear rating
Open Preview