Click here to Skip to main content
15,887,350 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Do you not understand booleans? Pin
CDP18029-Dec-11 4:24
CDP18029-Dec-11 4:24 
GeneralRe: Do you not understand booleans? Pin
BobJanova9-Dec-11 4:20
BobJanova9-Dec-11 4:20 
GeneralRe: Do you not understand booleans? Pin
Stefan_Lang12-Dec-11 5:40
Stefan_Lang12-Dec-11 5:40 
GeneralRe: Do you not understand booleans? Pin
Rob Grainger11-Dec-11 23:27
Rob Grainger11-Dec-11 23:27 
GeneralRe: Do you not understand booleans? Pin
Addy Tas13-Dec-11 12:43
Addy Tas13-Dec-11 12:43 
GeneralRe: Do you not understand booleans? Pin
RoelofDeVilliers12-Dec-11 3:15
RoelofDeVilliers12-Dec-11 3:15 
GeneralRe: Do you not understand booleans? Pin
Member 368731912-Dec-11 4:14
Member 368731912-Dec-11 4:14 
GeneralRe: Do you not understand booleans? Pin
BobJanova13-Dec-11 23:37
BobJanova13-Dec-11 23:37 
This is, at best, a matter of opinion. For me it is less clear to write if(x == true) because I have to read twice as much text to get the meaning &dnash; just as it's unclear to give a method a 300 character name. I have never met anyone who is confused by if(booleanVariable) and if they are then they shouldn't be programming until they learn the language they're using – if they have trouble reading that then do you really want them poking around your pointer code, or reflection in C#, or constructor injection frameworks, or any of the other million things any real world app has that are far more confusing?

Readability is all about having a single, clear, unambiguous meaning for a statement as quickly as possible. if(x) and if(!x) are short, clear and obviously different from each other (as long as you're using a font where ! is more than 2 pixels wide, heh). if(x == true) adds nothing, is easier to mix up with closely related but different statements (if(x = true) or if(x == True) or if(x == "true") etc) and doesn't immediately show that x is a boolean or castable to one until you read the whole thing.

You are on your way to becoming one of the micromanaging senior leads who appear on The Daily WTF issuing that kind of order based on your personal opinion of readability.
GeneralRe: Do you not understand booleans? Pin
RoelofDeVilliers18-Dec-11 9:25
RoelofDeVilliers18-Dec-11 9:25 
GeneralRe: Do you not understand booleans? Pin
Jeroen De Dauw10-Dec-11 12:03
Jeroen De Dauw10-Dec-11 12:03 
GeneralRe: Do you not understand booleans? Pin
harold aptroot10-Dec-11 22:53
harold aptroot10-Dec-11 22:53 
GeneralRe: Do you not understand booleans? Pin
Matthew Dennis11-Dec-11 15:41
sysadminMatthew Dennis11-Dec-11 15:41 
GeneralRe: Do you not understand booleans? Pin
PinballWizard12-Dec-11 1:53
PinballWizard12-Dec-11 1:53 
GeneralRe: Do you not understand booleans? Pin
PIEBALDconsult12-Dec-11 4:46
mvePIEBALDconsult12-Dec-11 4:46 
GeneralRe: Do you not understand booleans? Pin
Thornik12-Dec-11 3:05
Thornik12-Dec-11 3:05 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust12-Dec-11 4:14
YvesDaoust12-Dec-11 4:14 
GeneralRe: Do you not understand booleans? Pin
BloodyBaron1-Jan-12 3:25
BloodyBaron1-Jan-12 3:25 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust1-Jan-12 22:57
YvesDaoust1-Jan-12 22:57 
GeneralRe: Do you not understand booleans? Pin
Imperion12-Dec-11 4:44
Imperion12-Dec-11 4:44 
GeneralRe: Do you not understand booleans? Pin
Stefan_Lang12-Dec-11 6:02
Stefan_Lang12-Dec-11 6:02 
GeneralRe: Do you not understand booleans? Pin
Imperion12-Dec-11 6:36
Imperion12-Dec-11 6:36 
GeneralRe: Do you not understand booleans? Pin
JBoyer1112-Dec-11 4:45
JBoyer1112-Dec-11 4:45 
GeneralRe: Do you not understand booleans? Pin
Stefan_Lang12-Dec-11 6:00
Stefan_Lang12-Dec-11 6:00 
GeneralRe: Do you not understand booleans? Pin
patbob12-Dec-11 6:13
patbob12-Dec-11 6:13 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust1-Jan-12 23:42
YvesDaoust1-Jan-12 23:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.