You don’t get paid to write dependencies. To an extent, I think everybody knows this. But it’s worth saying bluntly because people will not say it to your face. Instead they’ll attempt to say other, nicer things, like “don’t reinvent the wheel” or “not-invented-here syndrome”. But really, that’s what they mean.
You don’t get paid to write dependencies because your users don’t care about your dependencies. Your users aren’t deciding to use your library on the basis of your node_modules size. Sure, dependencies can have an impact on your users. But that impact is often overestimated. Your users are not going to care if you distribute a binary that is a few megabytes too big. They’re not going to care if you use a CLI parsing library instead of writing your own.
And if they do care, if the difference between someone using your code and not is a few megabytes of storage, that’s not really a defensible moat.
There are exceptions to this rule. If you work on libraries or on tooling, you obviously get paid to write dependencies. Many people who work on open source do indeed get paid to write dependencies. And this is where the disconnect happens. Because those people tweet and they publish blogs1 and if you read this content, you start to get the impression that hey, I should write my own dependencies. However, the people who are writing your dependencies are still not writing their dependencies. They’re building their product, which happens to be your dependency.
You may say, hey, I looked at React’s dependencies and they only have one dependency. Yeah but they’re React. They have approximately a bajillion users. If you have a bajillion users you can write your dependencies.
The other exception is big tech. At big tech you can spend your whole career writing dependencies. Though again, these dependencies are almost always other people’s dependencies and therefore your product. Your users just happen to work at the same company as you. As well, again, big tech is an extremely rare situation where you are floating on a bed of money generated by one of the most ridiculously effective economic engines to ever exist. If your company makes hundreds of billions of dollars, yes, you can write your own dependencies.
Of course, this is not to say that you should never write dependencies. Sometimes you do in fact have a need that is not fulfilled by any libraries. But the calculus in your mind should be that the writing of the dependency is a loss. It is a loss of developer time, of future maintenance, of mental mindshare. What do you get back? If it’s the ability to write a feature that your users need, then yeah, that’s probably a good tradeoff. But if it’s some aesthetic belief around minimal dependencies, if it’s a few megabytes of binary size, if it’s a hypothetical issue that only arises once you have a bajillion users, well, then you are wasting your time.
Indeed this blog is written by someone who works in tooling and open source. ↩︎