Yoda Conditions
The act of using if (constant == variable) instead of natural if (variable == constant),; for example, if (4 == foo). Because it is like "if it is the blue – this is the sky" or "if that is tall – this is a man."

image

There's some really funny ones in this article, but in my C/C++ days "Yoda Conditions" were a best practice because it was all too easy to omit one of the '=' and turn a boolean expression into an assignment -- if( count = 5 ).. would set count to 5 and the expression would return true. if( 5 = count ) would outright fail at compile time since you can't change the value of a content constant. Getting into the habit of doing Yoda Conditions help reduce this risk. :)

Further down this list of slang, I also liked "Fear Driven Development". Its how I live my life!



blog comments powered by Disqus

Published

09 March 2012

Tags