-
Website
http://avdi.org/devblog -
Original page
http://avdi.org/devblog/2008/10/30/death-to-nil/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
bryanl
4 comments · 3 points
-
François Beausoleil
1 comment · 1 points
-
obiefernandez
1 comment · 2 points
-
gambling
3 comments · 2 points
-
Jakub Narebski
1 comment · 5 points
-
-
Popular Threads
-
Simplicity is Complicated
1 week ago · 25 comments
-
Double-Load Guards in Ruby
2 weeks ago · 4 comments
-
Array-ifying Values
2 weeks ago · 3 comments
-
ISO8601 Dates in Ruby
1 week ago · 2 comments
-
My WebOS Makefile
2 weeks ago · 2 comments
-
Simplicity is Complicated
Maybe the solution is to add a presentation layer that take care of this conditional nil check?
But Rails views are smelly in general, because as the least-OO part of Rails they are the hardest part to apply conventional OO patterns and idioms to.
First, being paranoid (or having an insecurity complex) during development can help prevent code from "working" until the 11th hour. Healthy use of asserts to check for NULL's in this case can be a good thing. Secondly, not all problem domains are the same. In the embedded and/or safety critical space, severe damage can result based on unexpected values propagating through code even during development. By working with the first point, significant and costly damage can be avoided (and, in my case, has been more than once.) So, in my case, I try to balance the compulsive (can you say OCD anyone?) checking against out of bounds values against the impact to performance. Specifically, I use assert() heavily to validate initial code passes in development and then disable the assert() when I judge code to be more stable. Of course, this is always a judgment call for any coder/designer.
I agree 100%
As for using one representation for two concepts, that's a valid argument, which is behind the anti-NULL-ers like Chris Date. I'm on the other side of that argument (the Codd side) and have no problem with the idea that nil represents a "non-value," especially in favor of fabrications like 9/9/99. That's what nil was designed to do. I've used languages without it (e.g. C) and I'm glad to have it. But as I indicated above, this isn't an argument that's going to get won any time soon. :)