Use Someone Elses

Cure for NotInventedHere. If you need a piece of code, you could write it yourself, thereby repeating the effort - and quite possibly the mistakes - of thousands of other programmers.

Or, you could

You can't UseSomeoneElses code without their permission, and sometimes their active co-operation. Many, though, are eager to give it. Consider accepting.

See also OtherPeoplesCode.


Once, a few years back, I needed to sort some java objects. I thought, surely there are hundreds of good sort routines on the web. There were; unfortunately, they were all descendants of one program distributed by none other than JamesGosling. I say unfortunately because they all had the same bug: failure on equal keys, a case Gosling hadn't tested. Fortunately, I'd written sorts before and had no trouble diving in and fixing it. Moral: it's easier to reuse when you could just as easily rewrite. -- WardCunningham

What was the sorting algorithm, and was it appropriate?


Last year (2001) I needed to embed FTP functionality into a (Java) content management system I was developing. I had written my own set of FTP classes the year before, but no longer had access to them, so I Googled for a Java FTP implementation. I found a couple. The one I downloaded turned out to be a complete mess. The original implementer didn't seem to understand Java synchronization and threading very well, and the whole thing was just a hodgepodge. But it worked. A few hours of refactoring turned into something clean and shiny, that still worked, and I was spared loads of implementation effort. Moral: even if the code is ugly, it's often better to reuse and refactor than to rewrite. -- RobertGreayer


See Also: SwipedFromTheBestWithPride, RewriteCodeFromScratch


EditText of this page (last edited December 31, 2010) or FindPage with title or text search