Image for post
Image for post

From Not Invented Here to Never Invented Here

Mar 24, 2016 · 5 min read

“Why didn’t you search NPM for a solution?” Bob asked. Alice thought she was being trolled, but it appeared Bob was totally serious. “Are you kidding? It’s 15 lines of code, and I put it in the shared folder.” Alice responded incredulously. “Yeah but now we’re responsible for maintaining it forever. If you’d used the open source module, maintenance is a problem for someone else” retorted Bob. Alice was speechless, could Bob really think that?

Recently there was quite a dust up in the Node community which resulted in many packages being broken because one developer decided trademark law shouldn’t apply to him. The main pain came from a single 11 line module called left-pad. At least the developer has not removed his packages from GitHub so for the short term, updates to affected packages package.json files should fix the issue. That said, there’s a bigger issue here and this event perfectly illustrates an anti-pattern that’s all too easy to fall into.

Most developers are perfectly reasonable people who use the code of others when necessary and write their own code when necessary. As with many things though, it’s not binary, it’s a spectrum. The spectrum ranges from the Not Invented Here crowd to the Never Invented Here crowd.

Not Invented Here

Never Invented Here

Understand Where You Fall on the Spectrum

Here are some strategies for staying in the “pattern” area of the spectrum and avoiding the “anti-pattern” edges. I use NPM as an example in some cases, but the strategies are generally applicable.

Time Box Searching

If you believe something will take effort on the order of days to weeks, spend no more than 20% of that time looking for someone else to have already solved the problem. If you can’t find something reasonable (i.e. solves 95% of the issue) then get to work and write some code.

Fork Dependencies

  • You’re insulated from the source repo getting unpublished
  • You’re insulated from accidental upgrades (though with package managers like NPM, you can shrinkwrap and achieve this)

To take advantage of bug fixes and new functionality in the package, you can easily pull from the source repo into your fork. It goes without saying that any fixes or additions you provide should be sent as a pull request to the original repo.

Using Open Source Doesn’t Relieve You of Responsibility

  1. Report and wait for the maintainer to fix it (something you have little to no control over)
  2. Fix it yourself which means you need to spend time reading and understanding the code so that your changes don’t have unintended side effects.
  3. Try to work around the issue, which may or may not be possible but will definitely result in a less than elegant solution.

As I’ve stated before, a good reason to use some open source package is a significant boost in velocity and/or reduction in risk of security or speed sensitive or otherwise complex areas. You still need to make sure that you trust that it will continue to be maintained, or that you can maintain or replace it yourself in a worst case scenario.

TLDR; Recap

About Me

If you enjoyed this post, I’d really appreciate a recommend (just click the heart below).

The Startup

Medium's largest active publication, followed by +733K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store