Click here to Skip to main content

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, embarrasing 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.

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralFound something interestingmemberBotCar17hrs 39mins ago 
Just came across the following in some code I maintain:
 
foreach (Object item in group)
{
// Some code...
int i = 1;
string key = "SomeString_" + i.ToString();
// Some more code...
}
 
I suspect the idea was to use i to help make the dictionary keys unique.
GeneralWhy not: // just shoot me!memberesaulsberry20 May '13 - 8:48 
try
{
    account.Save();
}
catch { ; } //Not good!
Mad | :mad:
GeneralRe: Why not: // just shoot me!memberPualee20 May '13 - 10:14 
At least there are comments.
GeneralRe: Why not: // just shoot me!protectorOriginalGriff20 May '13 - 11:02 
I can think of a few comments myself...
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

GeneralRe: Why not: // just shoot me!memberPankaj Nikam20 May '13 - 19:26 
Guess programmer was hungry thats why he "ate" the exception Big Grin | :-D
Always Keep Smiling.
Yours Pankaj Nikam

GeneralRe: Why not: // just shoot me!memberOshtri Deka20 May '13 - 22:15 
Relax.
This is just sweeping under the rug.
 

It could be worse.
Mislim, dakle jeo sam.

GeneralRe: Why not: // just shoot me!memberGary Wheeler21 May '13 - 1:17 
I'm impressed they wasted the energy on a surplus semicolon.
Software Zen: delete this;

GeneralRe: Why not: // just shoot me!memberenglebart21 May '13 - 2:39 
They might have a style rule that enforces:
"catch block cannot be empty"
 
Warning: Empty catch block.
 
ftfy: ";"
GeneralRe: Why not: // just shoot me!memberGary Wheeler21 May '13 - 2:48 
... which just demonstrates how misleading style enforcement can be.
Software Zen: delete this;

GeneralRe: Why not: // just shoot me!memberesaulsberry21 May '13 - 2:59 
Big Grin | :-D What kills me is the comment. It would have taken the same effort to say Logger.Log(ex);

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


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 24 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid