How to show if a method may return null
After posting this question and reading that one I realized that it is very important to know if a method is supposed to return null, or if this is considered an error condition and an exceptions should be thrown. There also is a nice discussion when to return ‘null’ or throw exception . I'm writing a method and I already know if I want to return null or throw an exception, what is the best way to express my decision, in other words, to document my contract? Some ways I can think of: Write it down in the specs / the documentation (will anyone read it?) Make it part of the method name (as I