Skip to main content

Zero

Posted by editor on July 25, 2007 at 7:28 AM PDT


Value of your supposedly reusable code: $0?!

We know that code reuse is important. Everyone's sick of writing the same things multiple times, wasting effort when surely there's some similar code that you wrote six months ago that could surely be refactored to serve both its old purpose and the new thing you're writing.

Or... not.

What if code reuse isn't all it's assumed to be? Maybe the reason we don't do it isn't that we're bad programmers or badly managed, but because code reuse isn't actually a good idea?

InfoQ quotes from a pair of essays on this topic in Code reuse highly overrated?. The first, Dennis Forbes' Internal Code Reuse Considered Dangerous from 2005, rails not against the abstract idea of code reuse, but rather against how it is typically practiced in the wild. A company will build up its own internal set of libraries, frameworks, components, etc., seemingly for reuse but in fact deeply tied into the company's own purposes, processes, and pathologies. When a new developer is told to just reuse this material, they often find it is nowhere close to reusable -- such internal products are typically shoddily documented, inadequately tested, and not really meant for reuse beyond the small number of projects already using it. Forbes says the key is an objective analysis:

The question every organization needs to ask itself, then, is what value they could sell their "reusable code" for - what, realistically, would competitors and new entrants in the field offer for it? The answer, in almost every case, is $0, and they wouldn't want it even at that price. There is extraordinarily little code theft in this industry (even though we're in the era of burnable DVDs and USB keys) because most code - above and beyond the industry-wide frameworks and libraries - has no value at all outside of a specific project with a specific group of developers. Trying to use it for other projects is often worse than starting with nothing at all.

In Is your code worthless?, Carl Lewis follows up with an anecdote about the reuse side of this equation. Tasked with integrating his company's code with a customer's, he found the customer jealously protective of its precious IP.

Since this customer was a big fish, I was sent to complete the integration at the customer