Suppose I have a method that takes an object of some kind as an argument. Now say that if this method is passed a null argument, it\'s a fatal error and an exception shoul
I'll probably be downvoted for this, but I think completely different.
What about following a good practice called "never pass null" and remove the ugly exception checking?
If the parameter is an object, DO NOT PASS NULL. Also, DO NOT RETURN NULL. You can even use the Null object pattern to help with that.
If it's optional, use default values (if your language supports them) or create an overload.
Much cleaner than ugly exceptions.