Say No to Null Checks(codelord.net)
codelord.net
Say No to Null Checks
http://www.codelord.net/2010/11/14/say-no-to-null-checks/
4 comments
Well, my point was that validating in the function does no good: it'll raise an error you'll see in the logs and debug later to try and understand what caused it.
Why not write the test that makes sure your code will never call the function with bad input and be done with it?
And, you should write a test. Period. A factory isn't needed and the bunch of shit is only if you're using version < 3.0.
Did you really miss this in the post? That's good input, thanks, and thanks for reading!
And, you should write a test. Period. A factory isn't needed and the bunch of shit is only if you're using version < 3.0.
Did you really miss this in the post? That's good input, thanks, and thanks for reading!
3.0 of what? I wasn't clear if your blog is about a particular framework/language (I'm guessing rails?)
Not validating input to a function, in general cases, is a bad idea, imho - tests or no tests - but that might be a matter of style or preference?
Not validating input to a function, in general cases, is a bad idea, imho - tests or no tests - but that might be a matter of style or preference?
Nah, it's not particular, 3.0 was a bad joke :)
Well, I know better than to get into discussions about style !
Well, I know better than to get into discussions about style !
No thanks.