Click here to Skip to main content
15,893,904 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.

 
AnswerRe: Best Practices turned into Coding Horrors. Pin
Chad3F22-Apr-13 11:38
Chad3F22-Apr-13 11:38 
GeneralRe: Best Practices turned into Coding Horrors. Pin
PIEBALDconsult16-Apr-13 15:23
mvePIEBALDconsult16-Apr-13 15:23 
GeneralRe: Best Practices turned into Coding Horrors. Pin
Pete O'Hanlon17-Apr-13 5:10
mvePete O'Hanlon17-Apr-13 5:10 
GeneralRe: Best Practices turned into Coding Horrors. Pin
Paulo Zemek17-Apr-13 5:19
mvaPaulo Zemek17-Apr-13 5:19 
GeneralRe: Best Practices turned into Coding Horrors. Pin
Pete O'Hanlon17-Apr-13 5:58
mvePete O'Hanlon17-Apr-13 5:58 
GeneralRe: Best Practices turned into Coding Horrors. Pin
BobJanova17-Apr-13 5:53
BobJanova17-Apr-13 5:53 
GeneralRe: Best Practices turned into Coding Horrors. Pin
KP Lee22-Apr-13 0:13
KP Lee22-Apr-13 0:13 
GeneralRe: Best Practices turned into Coding Horrors. Pin
KP Lee22-Apr-13 0:04
KP Lee22-Apr-13 0:04 
There are a lot of people who encounter "best practices", turn off the brain and spew out nonsense, a constant is evaluated once on the JIT compile and that is the last time it uses the string add.

Of course the DBA that gives a programmer direct read access to a table needs to be led out and shot....

There are good reasons for using StringBuilder, but that isn't one of them. I intentionally did string concatenation in my code to see how much StringBuilder helps. I got the code to work adding the statistics I gathered into a string. It ran in about 35 minutes. I added StringBuilder and cut the time to 15 minutes. I then added code to only convert the stats I built when I found a solution (several thousand) instead of when I created the stats (several million) and cut it down to 7 minutes. Finally I played around with the order of how the puzzle was solved and cut it to 4 minutes. My next improvement cut it down to 2 minutes. (Purchaced a computer with twice the rate of processing.)
AnswerRe: Best Practices turned into Coding Horrors. Pin
Clifford Nelson22-Apr-13 9:13
Clifford Nelson22-Apr-13 9:13 
GeneralRe: Best Practices turned into Coding Horrors. Pin
Paulo Zemek22-Apr-13 9:15
mvaPaulo Zemek22-Apr-13 9:15 
GeneralRe: Best Practices turned into Coding Horrors. Pin
Tim Yen22-Apr-13 14:02
Tim Yen22-Apr-13 14:02 
GeneralRe: Best Practices turned into Coding Horrors. Pin
Paulo Zemek22-Apr-13 15:21
mvaPaulo Zemek22-Apr-13 15:21 
GeneralLogical thinking could get very complicated Pin
Tomz_KV12-Apr-13 14:53
Tomz_KV12-Apr-13 14:53 
GeneralRe: Logical thinking could get very complicated Pin
Brisingr Aerowing12-Apr-13 16:10
professionalBrisingr Aerowing12-Apr-13 16:10 
GeneralRe: Logical thinking could get very complicated PinPopular
OriginalGriff12-Apr-13 23:16
mveOriginalGriff12-Apr-13 23:16 
GeneralRe: Logical thinking could get very complicated Pin
ENOTTY13-Apr-13 20:40
ENOTTY13-Apr-13 20:40 
GeneralRe: Logical thinking could get very complicated Pin
Tomz_KV15-Apr-13 1:40
Tomz_KV15-Apr-13 1:40 
JokeRe: Logical thinking could get very complicated Pin
Bernhard Hiller14-Apr-13 22:01
Bernhard Hiller14-Apr-13 22:01 
GeneralRe: Logical thinking could get very complicated Pin
Tomz_KV15-Apr-13 1:42
Tomz_KV15-Apr-13 1:42 
GeneralRe: Logical thinking could get very complicated Pin
ENOTTY15-Apr-13 4:25
ENOTTY15-Apr-13 4:25 
GeneralRe: Logical thinking could get very complicated Pin
YDaoust15-Apr-13 20:27
YDaoust15-Apr-13 20:27 
GeneralRe: Logical thinking could get very complicated Pin
Tomz_KV16-Apr-13 1:34
Tomz_KV16-Apr-13 1:34 
GeneralUnambiguously Ambiguous Pin
AspDotNetDev10-Apr-13 15:53
protectorAspDotNetDev10-Apr-13 15:53 
GeneralRe: Unambiguously Ambiguous Pin
Brisingr Aerowing10-Apr-13 17:13
professionalBrisingr Aerowing10-Apr-13 17:13 
GeneralRe: Unambiguously Ambiguous Pin
Wendelius10-Apr-13 18:37
mentorWendelius10-Apr-13 18:37 

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.