Click here to Skip to main content
15,920,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: Superman if-clause Pin
RugbyLeague12-Jul-10 4:22
RugbyLeague12-Jul-10 4:22 
GeneralRe: Superman if-clause Pin
Abhinav S9-Jul-10 7:59
Abhinav S9-Jul-10 7:59 
GeneralRe: Superman if-clause Pin
freakyit11-Jul-10 21:45
freakyit11-Jul-10 21:45 
GeneralRe: Superman if-clause Pin
leppie14-Jul-10 0:45
leppie14-Jul-10 0:45 
GeneralRe: Superman if-clause Pin
Kommrad Homer26-Jul-10 20:48
Kommrad Homer26-Jul-10 20:48 
Generaltry-catch code convention [modified] PinPopular
Kevin Drzycimski1-Jul-10 3:13
Kevin Drzycimski1-Jul-10 3:13 
GeneralRe: try-catch code convention Pin
RugbyLeague1-Jul-10 4:45
RugbyLeague1-Jul-10 4:45 
GeneralRe: try-catch code convention Pin
supercat91-Jul-10 6:27
supercat91-Jul-10 6:27 
RugbyLeague wrote:
Discarding errors is a great way to give the user the perception that all is right with the world.


Old VB6 provided a more convenient means, though: "ON ERROR RESUME NEXT". Unfortunately, its lack of "Try"-style methods for many things(*) tended to make a more appropriate coding style painful.

(*) There are many places where one might want to do an operation which one expects might fail, and not worry if it does; e.g. one may want to create a table if it doesn't exist, but ignore it if it does. Checking for existence before creation won't completely solve the problem, since another client might create the table after the existence check. The nicest way would be to say "do command X, but don't worry if it fails." Unfortunately, the only convenient way to do that is with ON ERROR RESUME NEXT, a concept so ugly Microsoft defined a special statement just for it.

Incidentally, if a routine does an ON ERROR RESUME NEXT and then invokes another routine that fails but does not have an ON ERROR statement, that other routine will exit out to the routine which did the ON ERROR RESUME NEXT. Nasty, but not so horrible as ON ERROR RESUME, which would restart the entire statement in the parent routine, likely causing many statements in the called routine to be re-executed.
GeneralRe: try-catch code convention Pin
Eddy Vluggen4-Jul-10 1:57
professionalEddy Vluggen4-Jul-10 1:57 
GeneralRe: try-catch code convention Pin
Stephen Hewitt6-Jul-10 14:54
Stephen Hewitt6-Jul-10 14:54 
GeneralRe: try-catch code convention Pin
Kevin Drzycimski7-Jul-10 20:42
Kevin Drzycimski7-Jul-10 20:42 
JokeRe: try-catch code convention PinPopular
Jon Sagara1-Jul-10 7:55
Jon Sagara1-Jul-10 7:55 
JokeRe: try-catch code convention Pin
DaveyM695-Jul-10 4:51
professionalDaveyM695-Jul-10 4:51 
GeneralRe: try-catch code convention Pin
Yusuf6-Jul-10 10:46
Yusuf6-Jul-10 10:46 
GeneralRe: try-catch code convention Pin
Jeroen De Dauw1-Jul-10 8:40
Jeroen De Dauw1-Jul-10 8:40 
GeneralRe: try-catch code convention Pin
Kevin Drzycimski1-Jul-10 8:54
Kevin Drzycimski1-Jul-10 8:54 
GeneralRe: try-catch code convention Pin
accesstomypc2-Jul-10 4:35
accesstomypc2-Jul-10 4:35 
GeneralRe: try-catch code convention Pin
Matt U.2-Jul-10 12:07
Matt U.2-Jul-10 12:07 
GeneralMessage Closed Pin
2-Jul-10 14:34
_beauw_2-Jul-10 14:34 
GeneralRe: try-catch code convention Pin
Jammer4-Jul-10 22:41
Jammer4-Jul-10 22:41 
GeneralRe: try-catch code convention Pin
whatrevolution3-Jul-10 17:46
whatrevolution3-Jul-10 17:46 
GeneralRe: try-catch code convention Pin
Nagy Vilmos4-Jul-10 2:10
professionalNagy Vilmos4-Jul-10 2:10 
GeneralRe: try-catch code convention Pin
Kevin Drzycimski4-Jul-10 2:19
Kevin Drzycimski4-Jul-10 2:19 
GeneralRe: try-catch code convention Pin
Bigdeak4-Jul-10 22:16
Bigdeak4-Jul-10 22:16 
GeneralMessage Closed Pin
5-Jul-10 8:13
_beauw_5-Jul-10 8:13 

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.