Maxi Contierimaximilianocontieri.com·Feb 7, 2023Code Smell 195 - Yoda ConditionsTL;DR: In a natural way, write your conditions. Problems Readability The least surprise principle violation Solutions Write your conditions with the expected value as the second. Name the variables accordingly. Context Most programmers write...12 likes·270 readsCode SmellsGeneral ProgrammingAdd a thoughtful comment1 commentTop commentsDeactivated User·Feb 8, 2023Feb 8, 2023I’ve always thought of Yoda conditions as a horrible practice, but, unfortunately, I still encounter those from time to time. Encountering those breaks code reading flow totally. 1·Reply
Deactivated User·Feb 8, 2023Feb 8, 2023I’ve always thought of Yoda conditions as a horrible practice, but, unfortunately, I still encounter those from time to time. Encountering those breaks code reading flow totally. 1·Reply