Timeline for Overused or abused programming techniques
Current License: CC BY-SA 2.5
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 4, 2014 at 15:08 | comment | added | Frank Hileman | This is terrible! To make it more explicit, we must check for true at least 3 times: if (((someCondition == true) == true) == true). This is great, as no one can misunderstand! If anyone does, just add more checks for true. There is no limit! :) | |
| Aug 31, 2011 at 19:56 | comment | added | Wayne Molina | I see this used quite often, much to my chagrin... from senior developers with several years experience... | |
| Mar 20, 2011 at 2:34 | comment | added | Thomas | What makes this anti-pattern evil is that some yokel comes along and changes it to if (someCondition != true) which is a 10' speed bump with respect to readability. | |
| Jan 16, 2011 at 8:41 | history | made wiki | Post Made Community Wiki | ||
| Jan 14, 2011 at 15:59 | comment | added | Corey | @DisgruntledGoat because it shouldn't be in use at all | |
| Jan 14, 2011 at 13:23 | comment | added | DisgruntledGoat | If you only "see this occasionally", how is it overused? | |
| Jan 13, 2011 at 20:07 | comment | added | Bevan | I've found this to be a strong code smell, not just because it's poor practice in itself, but because it's a strong indicator that the developer doesn't understand the language properly. For example, one dev I worked with who consistently wrote conditions this way in C# also insisted on passing lists by ref if the list was going to be modified. He clearly didn't understand the way memory was used, and he wrote a lot of nasty code as a consequence. | |
| Jan 12, 2011 at 10:52 | comment | added | Nobody | If you named your variables properly, for example bool s beginning with is or has, you don't need to make your code more explicit with = true. | |
| Jan 12, 2011 at 8:46 | comment | added | Konrad Rudolph | @Pemdas: disagree. If anything it makes the code less explicit since now it looks as though we’re testing for an arbitrary equality relation instead of for a condition. – Which, strictly speaking, is also an equality test but it’s a special case that’s important enough to merit an own syntax. | |
| Jan 12, 2011 at 2:22 | comment | added | Dominique McDonnell | I changed an instance of this and my lead, who I respect as a brilliant programmer, asked me to change it back as it was more explicit. | |
| Jan 11, 2011 at 22:56 | comment | added | MetalMikester | I don't do that but, seriously, get over it. There's a hell of a lot worse out there. :) | |
| Jan 11, 2011 at 21:17 | comment | added | gablin | I think a look at this question is in order: programmers.stackexchange.com/questions/12807/… | |
| Jan 11, 2011 at 21:16 | comment | added | Craige | @Pemdas - Agreed | |
| Jan 11, 2011 at 21:03 | comment | added | Pemdas | It does have the advantage of making code more explicit | |
| Jan 11, 2011 at 21:02 | history | answered | Corey | CC BY-SA 2.5 |