Click here to Skip to main content
15,908,111 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: What this 'null' check doing here... PinPopular
Nicholas Marty8-Jul-13 4:36
professionalNicholas Marty8-Jul-13 4:36 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed8-Jul-13 8:57
professionalMohammed Hameed8-Jul-13 8:57 
GeneralRe: What this 'null' check doing here... Pin
Trajan McGill8-Jul-13 5:34
Trajan McGill8-Jul-13 5:34 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed8-Jul-13 8:56
professionalMohammed Hameed8-Jul-13 8:56 
GeneralMessage Closed Pin
8-Jul-13 15:02
professionalBrisingr Aerowing8-Jul-13 15:02 
GeneralMessage Closed Pin
8-Jul-13 23:42
mentorThomas Daniels8-Jul-13 23:42 
JokeRe: What this 'null' check doing here... Pin
ZurdoDev9-Jul-13 4:19
professionalZurdoDev9-Jul-13 4:19 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 19:55
professionalMohammed Hameed10-Jul-13 19:55 
GeneralRe: What this 'null' check doing here... Pin
ZurdoDev11-Jul-13 1:32
professionalZurdoDev11-Jul-13 1:32 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed11-Jul-13 1:35
professionalMohammed Hameed11-Jul-13 1:35 
JokeRe: What this 'null' check doing here... Pin
Johnny YYZ10-Jul-13 1:23
professionalJohnny YYZ10-Jul-13 1:23 
GeneralRe: What this 'null' check doing here... Pin
vonb9-Jul-13 1:35
vonb9-Jul-13 1:35 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed9-Jul-13 1:39
professionalMohammed Hameed9-Jul-13 1:39 
RantRe: What this 'null' check doing here... Pin
Richard Deeming9-Jul-13 2:58
mveRichard Deeming9-Jul-13 2:58 
GeneralRe: What this 'null' check doing here... Pin
vonb9-Jul-13 3:56
vonb9-Jul-13 3:56 
GeneralRe: What this 'null' check doing here... Pin
Richard Deeming9-Jul-13 5:54
mveRichard Deeming9-Jul-13 5:54 
GeneralRe: What this 'null' check doing here... Pin
David C. Thompson10-Jul-13 3:05
David C. Thompson10-Jul-13 3:05 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 19:39
professionalMohammed Hameed10-Jul-13 19:39 
GeneralRe: What this 'null' check doing here... Pin
David C. Thompson10-Jul-13 20:51
David C. Thompson10-Jul-13 20:51 
GeneralRe: What this 'null' check doing here... Pin
Mark Starr10-Jul-13 4:25
professionalMark Starr10-Jul-13 4:25 
GeneralRe: What this 'null' check doing here... Pin
KP Lee10-Jul-13 20:19
KP Lee10-Jul-13 20:19 
GeneralRe: What this 'null' check doing here... Pin
Mark Starr11-Jul-13 5:18
professionalMark Starr11-Jul-13 5:18 
GeneralRe: What this 'null' check doing here... Pin
KP Lee15-Jul-13 20:32
KP Lee15-Jul-13 20:32 
GeneralRe: What this 'null' check doing here... Pin
Mark Starr16-Jul-13 5:20
professionalMark Starr16-Jul-13 5:20 
Not a prob, I was in fact, just starting the day, and clearly had too little coffee in my system to type, much less proof.

We had just been playing around with javascript to see what happens when you don't declare a variable versus when you declare it and don't assign a value - how it affects checking for undefined, not-undefined, null, etc. And, Yes, I typically write a lot more in T-SQL, but I also use VB, VB.NET, et al in my daily work - hence my disclaimer about not writing a lot of C#. I'm always careful when checking for nulls, so when I see comparison operator my hair stands up a bit.

Initially, to me, the code looked as though someone had somehow had a bad experience populating the list from using the "new List<employee>();" call, and so put in a safety-catch (if you will) to try again if necessary. Or, perhaps, the second part was already there, and someone later came along and added the first line... I'm sure they though it was right at the time. Who knows!

Thanks for the note KP. Cheers and happy coding,
Mark
GeneralRe: What this 'null' check doing here... Pin
GrumpyPants10-Jul-13 5:33
GrumpyPants10-Jul-13 5:33 

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.