Click here to Skip to main content
15,921,028 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: Bool expression?? Pin
codemunch12-Feb-08 6:51
codemunch12-Feb-08 6:51 
GeneralRe: Bool expression?? Pin
Erich Ledesma8-Feb-08 8:52
Erich Ledesma8-Feb-08 8:52 
GeneralRe: Bool expression?? Pin
dojohansen12-Feb-08 3:18
dojohansen12-Feb-08 3:18 
Either you've understood that "(x < 5)" is a boolean expression every bit as much as the boolean constants "true" and "false", or you haven't. There's nothing in between. The code makes it look as if the condition is somehow not a boolean expression, and therefore highlights the author's lack of understanding, of something quite fundamental, and therefore deserves to be on display as a coding horror, in my opinion.

For some reason I see this done a lot with ternaries in C#:

return (s == "toto"? true : false);


Unfortunately proper use is less commonly seen, such as

return (row != null? (int)row["count"] : -1);
GeneralRe: Bool expression?? Pin
Paddy Boyd8-Feb-08 4:51
Paddy Boyd8-Feb-08 4:51 
GeneralRe: Bool expression?? Pin
leppie8-Feb-08 5:51
leppie8-Feb-08 5:51 
GeneralRe: Bool expression?? Pin
Sean Williams11-Feb-08 20:51
Sean Williams11-Feb-08 20:51 
GeneralRe: Bool expression?? Pin
Sean Williams11-Feb-08 20:53
Sean Williams11-Feb-08 20:53 
GeneralRe: Bool expression?? Pin
Sean Williams11-Feb-08 20:57
Sean Williams11-Feb-08 20:57 
GeneralRe: Bool expression?? Pin
dojohansen12-Feb-08 3:22
dojohansen12-Feb-08 3:22 
GeneralRe: Bool expression?? Pin
Paul Conrad17-Feb-08 6:50
professionalPaul Conrad17-Feb-08 6:50 
GeneralRe: Bool expression?? Pin
PIEBALDconsult2-Apr-08 8:00
mvePIEBALDconsult2-Apr-08 8:00 
GeneralChildhood coding Pin
Daniel 'Tak' M.6-Feb-08 16:20
Daniel 'Tak' M.6-Feb-08 16:20 
GeneralRe: Childhood coding Pin
Pete O'Hanlon6-Feb-08 21:54
mvePete O'Hanlon6-Feb-08 21:54 
GeneralRe: Childhood coding Pin
NormDroid7-Feb-08 0:18
professionalNormDroid7-Feb-08 0:18 
GeneralRe: Childhood coding Pin
Dan Neely7-Feb-08 2:16
Dan Neely7-Feb-08 2:16 
GeneralRe: Childhood coding Pin
ClementsDan7-Feb-08 5:21
ClementsDan7-Feb-08 5:21 
GeneralRe: Childhood coding Pin
Daniel 'Tak' M.7-Feb-08 7:38
Daniel 'Tak' M.7-Feb-08 7:38 
GeneralRe: Childhood coding Pin
PIEBALDconsult7-Feb-08 7:46
mvePIEBALDconsult7-Feb-08 7:46 
GeneralRe: Childhood coding Pin
MidwestLimey7-Feb-08 12:05
professionalMidwestLimey7-Feb-08 12:05 
GeneralRe: Childhood coding Pin
Daniel 'Tak' M.7-Feb-08 12:15
Daniel 'Tak' M.7-Feb-08 12:15 
JokeRe: Childhood coding Pin
Xiangyang Liu 刘向阳9-Feb-08 14:53
Xiangyang Liu 刘向阳9-Feb-08 14:53 
GeneralA "New" Way to practice TDD Pin
Philip Laureano6-Feb-08 13:39
Philip Laureano6-Feb-08 13:39 
GeneralRe: A "New" Way to practice TDD Pin
Shog96-Feb-08 17:21
sitebuilderShog96-Feb-08 17:21 
GeneralRe: A "New" Way to practice TDD Pin
Ray Cassick7-Feb-08 11:13
Ray Cassick7-Feb-08 11:13 
GeneralPremature Disposal Pin
Rob Grainger6-Feb-08 5:30
Rob Grainger6-Feb-08 5:30 

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.