

Say No to Null Checks - abyx
http://www.codelord.net/2010/11/14/say-no-to-null-checks/

======
jawngee
So instead of validating input into a function, I should write a test, a
factory and a bunch of other shit?

No thanks.

~~~
abyx
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!

~~~
jawngee
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?

~~~
abyx
Nah, it's not particular, 3.0 was a bad joke :)

Well, I know better than to get into discussions about style !

