Timeline for Boolean Method Naming Affirmative vs Negative
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 15, 2020 at 4:47 | comment | added | Martin Maat | You typically want to make the thing to signal the positive, you want to "raise the flag" for the case to be aware of. This COULD be a linguistic negative. You can then see if you can fix that (like naming something isMissing rather than exists). See also softwareengineering.stackexchange.com/questions/414575/… | |
Oct 15, 2020 at 1:48 | answer | added | RayLuo | timeline score: 3 | |
Sep 27, 2018 at 17:44 | comment | added | julealgon |
Just wanted to chime in to say that if (!exists) create() can be seen as a bad practice in many languages/frameworks, as it tends to not be thread-safe. Usually, the preferred approach is to call create() and handle specific exceptions or return codes saying that the entity already exists. This is of course not an answer to the actual question (which is why it is a comment only).
|
|
Jul 20, 2017 at 18:36 | comment | added | Berin Loritsch |
to-may-to to-mah-to. Honestly, I have missed the ! character so many times causing me to mis-understand the code until I re-read it again. So I probably agree more with your coworker. I like the form that evaluates to true when you examine it.
|
|
Jul 20, 2017 at 10:52 | history | protected | gnat | ||
Jul 20, 2017 at 10:46 | answer | added | Jon Snow | timeline score: 3 | |
Jul 21, 2016 at 11:16 | comment | added | gnat | related: Naming boolean variables: negated or not | |
May 15, 2013 at 7:57 | audit | Close votes | |||
May 15, 2013 at 7:58 | |||||
May 3, 2013 at 20:06 | history | tweeted | twitter.com/#!/StackProgrammer/status/330412957076946944 | ||
May 2, 2013 at 15:36 | comment | added | Kos |
C++? how about if (not entity_exists(entity_id))
|
|
May 2, 2013 at 13:24 | vote | accept | lynks | ||
May 2, 2013 at 12:38 | answer | added | Caleb | timeline score: 79 | |
May 2, 2013 at 12:26 | answer | added | Dan Pichelman | timeline score: 16 | |
May 2, 2013 at 12:21 | review | First posts | |||
May 2, 2013 at 12:31 | |||||
May 2, 2013 at 12:07 | history | edited | lynks | CC BY-SA 3.0 |
added 1 characters in body
|
May 2, 2013 at 12:02 | history | asked | lynks | CC BY-SA 3.0 |