views:

222

answers:

8

I've certainly done this : written a load of code to do some operation, then discovered that the language already had that functionality built in. An early case i remember is writing a function to reverse a string in VB6, then stumbling across StrReverse a week later. What's your worst example of this?

A: 

Creating a function in VB6 to create a string with a number of spaces.
I later found that I could simply do:

Dim str As String
str = String(10)
Nelson Reis
A: 

We once tried to create a method to shuffle a Collection in Java :)

EDIT: corrected "sort" to "shuffle"

Savvas Dalkitsis
A: 

Copying arrays, only to later find that you have System.arraycopy().

Shivasubramanian A
+4  A: 

One of my co-worker once tried to write a full-featured XML parser in c# ...

Brann
aouts... :P poor guy
Savvas Dalkitsis
Did he try to use regex?
rascher
+1  A: 

I once tried to write HTML editor in jscript as my employer did not want to buy one in or use an open source one.

Ian Ringrose
A: 

In one inspired period during my first programming job I decided it would be a good idea to write a thread pool to deal with a number of items of work in parallel in C#. Armed with a list of jobs to process and a maximum number of threads I could use I set to work.

My downfall came when I decided that keeping the thread pool going with while (true) and no sleep was a good idea. A sentiment not shared by my fellow developers, especially since I ran the service on our main database server. I think it took two minutes before someone spotted things 'had got a little slow' on the box.

Needless to say I now think of 'the threadpool incident' and look around for things someone else has written before deciding I need to reinvent the wheel.

UltimatePace
+1  A: 

I once implemented several sorting algorithms in Java only to have my boss tell me about Java's sorting classes.

gshauger
+4  A: 

A couple of jobs ago a co-worker didn't trust SQL's JOIN so he set about writing one himself...

n8wrl
That is truly epic.
Beska
Wow, that must have been painful to look at.
Neil Aitken
Ouch. I'm curious what drove him not to trust it
CodeByMoonlight