by fedlarm · 12y ago · 0 comments
I have used the name || "no name" operator a lot and thought to myself that it looked cool on first impression. But having something like: isAwesome() && alert("yay"); Already makes it harder to read I think. I'm curious to what others think of this one? Maybe its just because it is new to me..
To be honest, I like and use some of those, especially when writing experimental/disposable code, but otherwise I try to be gentle to less experienced developers and my future self.
As of #5 - I used to do and love this when writing unit tests. At the end of the work day, if I'm in the middle of implementing a feature, I'd commit and then write the next unit test (inevitably) sitting in my head and leave it failing. Really helps when it's Monday.
C is particularly dangerous because it will normally short-circuit, but the standard doesn't require it and in rare cases the compiler will optimize it out.
http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/