Click here to Skip to main content
15,886,919 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
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 
I hate this code too. Maybe in C you can do this but in C# it is a travesty. What I do is create self-documenting booleans so that you write code like this:

C#
if (DoorIsOpen)
{
  // Do Something
}
else
{
  // Do Something else
}


I feel that this eliminates the need for any of the crap above. It is true that the compiler doesn't care but just remember the the point of code is so humans can understand it. If we only cared about the computer understanding it, we would all be typing 1s and 0s. Write code so that those who come after you can read it without being distracted by how horrible it is.
"I don't believe it."
"That is why you fail." -- Empire Strikes Back

Shameless blog plug - www.geekswithblogs.net/jboyer

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 
GeneralRe: Do you not understand booleans? Pin
patbob3-Jan-12 6:39
patbob3-Jan-12 6:39 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust3-Jan-12 23:48
YvesDaoust3-Jan-12 23:48 
JokeRe: Do you not understand booleans? Pin
Rick Shaub12-Dec-11 7:27
Rick Shaub12-Dec-11 7:27 
GeneralRe: Do you not understand booleans? Pin
Stefan_Lang12-Dec-11 21:57
Stefan_Lang12-Dec-11 21:57 
GeneralRe: Do you not understand booleans? Pin
rcampbell1212-Dec-11 10:51
rcampbell1212-Dec-11 10:51 
GeneralRe: Do you not understand booleans? Pin
Nunnenkamp13-Dec-11 6:34
Nunnenkamp13-Dec-11 6:34 
GeneralRe: Do you not understand booleans? Pin
fjdiewornncalwe13-Dec-11 7:08
professionalfjdiewornncalwe13-Dec-11 7:08 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust1-Jan-12 23:50
YvesDaoust1-Jan-12 23:50 
GeneralRe: Do you not understand booleans? Pin
KP Lee13-Dec-11 19:19
KP Lee13-Dec-11 19:19 
GeneralRe: Do you not understand booleans? Pin
Clive D. Pottinger15-Dec-11 17:09
Clive D. Pottinger15-Dec-11 17:09 
GeneralRe: Do you not understand booleans? Pin
John Hunley19-Dec-11 6:47
John Hunley19-Dec-11 6:47 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust2-Jan-12 0:10
YvesDaoust2-Jan-12 0:10 
GeneralRe: Do you not understand booleans? Pin
Jeroen De Dauw25-Dec-11 11:24
Jeroen De Dauw25-Dec-11 11:24 
GeneralRe: Do you not understand booleans? Pin
ChunkyStool3-Jan-12 12:25
ChunkyStool3-Jan-12 12:25 

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.