Click here to Skip to main content
15,908,909 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: What happens when a Java coder decides to explain a Red Black Tree in C#? Pin
Mike Dimmick14-Dec-07 13:38
Mike Dimmick14-Dec-07 13:38 
I have to say I can't see that many problems. Discarding every other random number is a bit weird in the first example. Throughout there's a reliance on the low-precision system clock returned with DateTime.Now and TimeSpan.Milliseconds returns the milliseconds part only, you should use TotalMilliseconds if you want it to tell you how many seconds elapsed. For more accurate timing results use a System.Diagnostics.Stopwatch.

At this point any collection which doesn't support generics is pretty stupid, the whole thing should be parameterized on T with a restriction that T derives from IComparable<T> or allows you to supply an IComparer<T>.

I'd like to see a comparison with inserting into a sorted ArrayList or List<T> and using BinarySearch. A lot of emphasis is put on the computational algorithmic complexity of data structures and algorithms, but these days practical algorithm performance is based on memory speed hierarchies, and cache locality is very important. Further, an array typically represents a lower load on the garbage collector than a deeply-linked data structure (fewer pointers to follow). There is a reason why Microsoft didn't and still don't supply linked list or binary tree structures with the .NET Framework.

DoEvents: Generating unexpected recursion since 1991

Generalcss disaster Pin
sdix10-Dec-07 11:07
sdix10-Dec-07 11:07 
GeneralRe: css disaster Pin
Ri Qen-Sin11-Dec-07 5:00
Ri Qen-Sin11-Dec-07 5:00 
GeneralRe: css disaster Pin
leppie11-Dec-07 7:40
leppie11-Dec-07 7:40 
GeneralRe: css disaster Pin
Pete O'Hanlon11-Dec-07 10:19
mvePete O'Hanlon11-Dec-07 10:19 
GeneralConstants definitions Pin
Dr. Emmett Brown6-Dec-07 4:05
Dr. Emmett Brown6-Dec-07 4:05 
QuestionRe: Constants definitions Pin
Steve Hansen9-Dec-07 23:23
Steve Hansen9-Dec-07 23:23 
GeneralRe: Constants definitions Pin
Dr. Emmett Brown10-Dec-07 14:46
Dr. Emmett Brown10-Dec-07 14:46 
GeneralRe: Constants definitions Pin
PIEBALDconsult10-Dec-07 15:39
mvePIEBALDconsult10-Dec-07 15:39 
GeneralRe: Constants definitions Pin
KarstenK12-Dec-07 22:42
mveKarstenK12-Dec-07 22:42 
GeneralRe: Constants definitions Pin
supercat911-Dec-07 9:07
supercat911-Dec-07 9:07 
GeneralRe: Constants definitions Pin
Frank Dawson10-Dec-07 15:25
Frank Dawson10-Dec-07 15:25 
GeneralRe: Constants definitions Pin
KarstenK12-Dec-07 22:47
mveKarstenK12-Dec-07 22:47 
GeneralRe: Constants definitions Pin
CurtD13-Dec-07 13:05
CurtD13-Dec-07 13:05 
GeneralThis one made me sigh Pin
CARPETBURNER6-Dec-07 0:40
CARPETBURNER6-Dec-07 0:40 
GeneralRe: This one made me sigh Pin
Sathesh Sakthivel6-Dec-07 1:49
Sathesh Sakthivel6-Dec-07 1:49 
GeneralRe: This one made me sigh Pin
Russell Jones6-Dec-07 2:51
Russell Jones6-Dec-07 2:51 
GeneralRe: This one made me sigh Pin
Mike Dimmick6-Dec-07 22:59
Mike Dimmick6-Dec-07 22:59 
GeneralRe: This one made me sigh Pin
Ri Qen-Sin7-Dec-07 5:10
Ri Qen-Sin7-Dec-07 5:10 
GeneralRe: This one made me sigh Pin
Jeffrey Walton7-Dec-07 22:03
Jeffrey Walton7-Dec-07 22:03 
GeneralRe: This one made me sigh Pin
Paul Conrad8-Dec-07 5:05
professionalPaul Conrad8-Dec-07 5:05 
GeneralThe holy comma operator [modified] Pin
Doc Lobster26-Nov-07 2:47
Doc Lobster26-Nov-07 2:47 
GeneralRe: The holy comma operator Pin
Steve Hansen26-Nov-07 4:36
Steve Hansen26-Nov-07 4:36 
GeneralRe: The holy comma operator Pin
jhwurmbach26-Nov-07 5:20
jhwurmbach26-Nov-07 5:20 
GeneralRe: The holy comma operator Pin
Kastellanos Nikos27-Nov-07 22:40
Kastellanos Nikos27-Nov-07 22:40 

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.