Click here to Skip to main content
15,887,585 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: I hope this is not contagious... Pin
CDP180228-Jun-12 22:21
CDP180228-Jun-12 22:21 
GeneralRe: I hope this is not contagious... Pin
Brisingr Aerowing29-Jun-12 7:16
professionalBrisingr Aerowing29-Jun-12 7:16 
GeneralRe: I hope this is not contagious... Pin
CDP180228-Jun-12 22:23
CDP180228-Jun-12 22:23 
GeneralRe: I hope this is not contagious... Pin
Bernhard Hiller28-Jun-12 21:55
Bernhard Hiller28-Jun-12 21:55 
GeneralRe: I hope this is not contagious... Pin
CDP180228-Jun-12 22:17
CDP180228-Jun-12 22:17 
GeneralString Comparison Pin
Rotted Frog25-Jun-12 18:26
Rotted Frog25-Jun-12 18:26 
GeneralRe: String Comparison Pin
Mohibur Rashid25-Jun-12 20:43
professionalMohibur Rashid25-Jun-12 20:43 
GeneralRe: String Comparison Pin
Nagy Vilmos25-Jun-12 21:59
professionalNagy Vilmos25-Jun-12 21:59 
Not only is at a total waste of processing, but a stupid thing to do. However bad the excessive ToUpper calls, the greater horror is using object comparison when equality is the (probable) intent.

IIRC the String class overrides == but this is such bad practice the coder should be shot. Repeatedly.

As an aside, comparing an object to a constant, you should always put the constant first as it removes the need for null checks:

C#
if ("CAMELCASENAME".equals(name.ToUpper())) {
   ...
}



Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

GeneralRe: String Comparison Pin
Rotted Frog25-Jun-12 22:20
Rotted Frog25-Jun-12 22:20 
GeneralRe: String Comparison Pin
VallarasuS25-Jun-12 23:48
VallarasuS25-Jun-12 23:48 
GeneralRe: String Comparison Pin
AspDotNetDev26-Jun-12 8:53
protectorAspDotNetDev26-Jun-12 8:53 
GeneralRe: String Comparison Pin
Rahul Rajat Singh26-Jun-12 0:56
professionalRahul Rajat Singh26-Jun-12 0:56 
QuestionRe: String Comparison Pin
CoperNick26-Jun-12 12:36
CoperNick26-Jun-12 12:36 
GeneralRe: String Comparison Pin
ZurdoDev26-Jun-12 1:53
professionalZurdoDev26-Jun-12 1:53 
GeneralRe: String Comparison Pin
Vladimir Svyatski1-Jul-12 1:17
professionalVladimir Svyatski1-Jul-12 1:17 
GeneraldataTables to to gridView Pin
Michael Sernal25-Jun-12 8:10
Michael Sernal25-Jun-12 8:10 
JokeRe: dataTables to to gridView Pin
Albert Holguin25-Jun-12 17:38
professionalAlbert Holguin25-Jun-12 17:38 
GeneralRe: dataTables to to gridView Pin
ZurdoDev26-Jun-12 1:55
professionalZurdoDev26-Jun-12 1:55 
GeneralSpecial Case PinPopular
Rotted Frog18-Jun-12 4:46
Rotted Frog18-Jun-12 4:46 
GeneralRe: Special Case Pin
Brisingr Aerowing18-Jun-12 5:01
professionalBrisingr Aerowing18-Jun-12 5:01 
GeneralRe: Special Case PinPopular
CDP180218-Jun-12 5:08
CDP180218-Jun-12 5:08 
GeneralRe: Special Case Pin
Brisingr Aerowing18-Jun-12 5:11
professionalBrisingr Aerowing18-Jun-12 5:11 
GeneralRe: Special Case Pin
PIEBALDconsult18-Jun-12 5:36
mvePIEBALDconsult18-Jun-12 5:36 
GeneralRe: Special Case Pin
Sentenryu18-Jun-12 7:00
Sentenryu18-Jun-12 7:00 
GeneralRe: Special Case PinPopular
RobCroll18-Jun-12 14:59
RobCroll18-Jun-12 14:59 

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.