This is brianary's Typepad Profile.
Join Typepad and start following brianary's activity
Join Now!
Already a member? Sign In
Recent Activity
Yoda Conditions are a useful way to force the type of the comparison in dynamic languages, since the left-hand side usually gets to establish the type of the comparison when it could otherwise be ambiguous. $num = "5"; if(5 == $num) { ... } Even in statically-typed languages, you'll often have to cast a type, and Yoda Conditions make that more readable than a big Lispy pile of parentheses. if(1 == (int)dr["num"]) { ... } // already has two pair parens if(((int)dr["num"]) == 1) { ... } // too many parens Stateful mental parsing of deeply nested parentheses seems a bigger problem than some Anglocentric difficulty with determining if two things are equal.
Toggle Commented Jul 23, 2012 on New Programming Jargon at Coding Horror
brianary is now following The Typepad Team
Jul 23, 2012