Community Page
- avdi.org/devblog Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- FKING WESTERN UNION!!!!!!!!!!!!!!!!!!!!!!!!!! I HATE IT!!!!!!!!!!!!!!!!!!!!!!!!!!! IM HAVING THE SAME DARN PROBLEM!! CAN'T LOG IN!!!
- I'm very sad I missed Barcamp (and it would have been great to catch up with you, as well). Hopefully I'll be at the next one. At any rate, I did have a great day-before-father's-day...
- Good insight. A lot of social gatherings like Green Drinks seem to be a majority female. Cross pollination between Greens and Geeks might be a good thing.
- Wow, the hackerspace thing is so rad. I wish there was one in the Harrisburg area.
- Yeah, I overstated, as is my wont. I guess the real issue I have is that the practices are already starting to read a tiny bit like a "Java list". Java was all about taking away all the...
Jump to original thread »
A common idiom in ruby is to call a method only if its receiver is not nil:
thing.foo if thing
or:
thing && thing.foo
Various libraries exist for making this a little more convenient. You can use andand, or if you are using Facets you c ... Continue reading »
thing.foo if thing
or:
thing && thing.foo
Various libraries exist for making this a little more convenient. You can use andand, or if you are using Facets you c ... Continue reading »
8 months ago
8 months ago
8 months ago
Maybe the solution is to add a presentation layer that take care of this conditional nil check?
8 months ago
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.
8 months ago
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.
8 months ago
8 months ago
8 months ago
8 months ago
I agree 100%
8 months ago
8 months ago
8 months ago
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. :)