DEV Community


Discussion on: The Demise of Reuse

jillesvangurp profile image
Jilles van Gurp

One way to think about reuse is considering that you don't just ship the code you wrote but also everything that depends on including libraries, frameworks, the OS, tool chains, etc. Literally hundreds of millions lines of code. When you consider that, you'll realize that the vast majority of what you ship is reused code written by others. And it's not just the code you reuse but also the testing and integration effort that went into making all of that rock solid. What you create is literally just a tiny fraction of that.

The larger your own code base is the more likely it is to include bits and pieces that are effectively reinvented wheels that surely, somebody else did on some unrelated project in a remarkably similar way. If you write a lot of the same bits of code over and over again (i.e. you are repeating yourself, a lot), you are probably doing something wrong. That's fine up to a point but once you get large groups of people writing the same software in the same way, it's just a matter of time before some of them start publishing bits and pieces as reusable libraries and sharing them in order to be faster to market. There's some simple darwinian principle here where those that reuse smarter tend to build more and cheaper.

Also, the economics of developing large codebases are somewhat funny. Testing and integration effort for example scales exponentially to the amount of change. Meaning that testing a 50K delta to a 5 MLOC system is way more expensive than testing 500 deltas of 100 lines of code to the same system. Owning code is a really expensive hobby.

This is also why it is relatively expensive to develop large code bases in house that reinvent a lot of wheels. You can trivially outcompete companies that do that with smaller code bases and smaller teams that depend on e.g. oss libraries that provide the common bits and pieces. Write less with fewer people and you cut down on that exponential cost. Reuse these days is about avoiding to write code altogether by reusing pre-existing stuff instead of reinventing stuff. Focus your R&D on the stuff that actually needs inventing.

This is why the likes of Whatsapp can create companies worth billions with less than 50 people. Most of what they did was reuse preexisting stuff in a clever way. I used to work for a company (Nokia) that arguably spent way more on R&D on remarkably similar projects (yes, multiple) while ultimately failing to get the job done. And they weren't the only ones.