One thing to remember that your code that you write today while it may be a small team and you can have good documentation, will turn into legacy code that someone else will have to maintain. I use the following rules:
-
If I’m writing a public API that will be exposed to others, then I will do null checks on all reference parameters.
-
If I’m writing an internal component to my application, I write null checks when I need to do something special when a null exists, or when I want to make it very clear. Otherwise I don’t mind getting the null reference exception since that is also fairly clear what is going on.
-
When working with return data from other peoples frameworks, I only check for null when it is possible and valid to have a null returned. If their contract says it doesn’t return nulls, I won’t do the check.