Click here to Skip to main content
15,922,584 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: switch statement Pin
xenonysf21-Nov-07 2:05
xenonysf21-Nov-07 2:05 
GeneralRe: switch statement Pin
Tony Wesley21-Nov-07 6:50
Tony Wesley21-Nov-07 6:50 
GeneralRe: switch statement Pin
DavidNohejl16-Nov-07 13:39
DavidNohejl16-Nov-07 13:39 
GeneralRe: switch statement Pin
bsaksida17-Nov-07 4:12
bsaksida17-Nov-07 4:12 
GeneralRe: switch statement Pin
Tony Wesley17-Nov-07 4:31
Tony Wesley17-Nov-07 4:31 
GeneralRe: switch statement Pin
bsaksida17-Nov-07 4:16
bsaksida17-Nov-07 4:16 
GeneralRe: switch statement Pin
Tony Wesley17-Nov-07 4:45
Tony Wesley17-Nov-07 4:45 
Generaltry-catch Oo [modified] Pin
Oshtri Deka16-Nov-07 0:19
professionalOshtri Deka16-Nov-07 0:19 
I have found, on several places in our app, code similar to this:

try<br />
{<br />
   //some code here<br />
}catch{}


Confused | :confused:

Do I need to say I have found that during urgent debugging session (important customer had had complaints)

Empty catch blocks, and most of them were in methods which deal with data.
Let's just say that we use multi-threading and reflection, a lot, and I spent too much time on only localizing this.

Why are people so reckless? I am far from being expert, but everyone who likes to think about oneself as a coder or developer should use common sense.
Mad | :mad:


Notice: Somehow (perhaps in a state of fury) I have forgotten to describe places where I had found above mentioned problem, and that has made this post is a bit misleading.
Programmer who have written that code, used this "technique" only to sweep things under the rug!
No returning values, filling dataSets, no validation, allowing bad user input (constraint violations)... in short error-exception domino which occurs only in specific situations.

I am aware that empty try-catch block isn't excuse for witch hunt, but (at least) generally it isn't best practice. When I am not sure if something is preferable, I ask more experienced colleagues.



-- modified at 6:31 Tuesday 20th November, 2007
JokeRe: try-catch Oo Pin
Nemanja Trifunovic16-Nov-07 1:35
Nemanja Trifunovic16-Nov-07 1:35 
GeneralRe: try-catch Oo Pin
Nathan Holt at EMOM16-Nov-07 7:43
Nathan Holt at EMOM16-Nov-07 7:43 
GeneralRe: try-catch Oo Pin
Oshtri Deka16-Nov-07 11:14
professionalOshtri Deka16-Nov-07 11:14 
GeneralRe: try-catch Oo Pin
Ware@Work30-Nov-07 3:55
Ware@Work30-Nov-07 3:55 
GeneralRe: try-catch Oo Pin
Robert Royall16-Nov-07 9:45
Robert Royall16-Nov-07 9:45 
QuestionRe: try-catch Oo Pin
Chris Meech16-Nov-07 10:23
Chris Meech16-Nov-07 10:23 
AnswerRe: try-catch Oo Pin
Robert Royall16-Nov-07 12:38
Robert Royall16-Nov-07 12:38 
GeneralRe: try-catch Oo Pin
Oshtri Deka16-Nov-07 11:27
professionalOshtri Deka16-Nov-07 11:27 
GeneralRe: try-catch Oo Pin
Brady Kelly16-Nov-07 22:05
Brady Kelly16-Nov-07 22:05 
GeneralRe: try-catch Oo Pin
Chris Losinger17-Nov-07 12:40
professionalChris Losinger17-Nov-07 12:40 
GeneralRe: try-catch Oo Pin
StM0n21-Nov-07 0:26
StM0n21-Nov-07 0:26 
GeneralRe: try-catch Oo Pin
Mycroft Holmes29-Nov-07 16:37
professionalMycroft Holmes29-Nov-07 16:37 
GeneralRe: try-catch Oo Pin
Chris Losinger30-Nov-07 1:03
professionalChris Losinger30-Nov-07 1:03 
GeneralWhat does it do? Pin
bigbrownbeaver15-Nov-07 23:15
bigbrownbeaver15-Nov-07 23:15 
GeneralRe: What does it do? Pin
CPallini15-Nov-07 23:43
mveCPallini15-Nov-07 23:43 
GeneralRe: What does it do? Pin
Vasudevan Deepak Kumar16-Nov-07 0:00
Vasudevan Deepak Kumar16-Nov-07 0:00 
GeneralRe: What does it do? Pin
Pete O'Hanlon16-Nov-07 2:43
mvePete O'Hanlon16-Nov-07 2:43 

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.