By dlinsin
via dlinsin.blogspot.com
Submitted: Jul 08 2008 / 00:12
In a previous post I'm suggesting to properly document your API, in particular constraints of method arguments. Users of your API should know what they can safely pass to methods and what needs to be checked upfront. Documentation is good, but how do you know that your users gonna read it or adhere to it? Well, you don't! That's the reason why you shouldn't trust users and stick to a defensive programming style. In order to prevent faulty injection and to fail fast, you should check every argument according to the specs, defined in the javadocs.
Add your comment