Moreover, it's getting quite easy to maintain dependencies today. I can think about packages lock files, Docker containers, semantic versionning, or even Github sending me alerts and pull requests when a security vulnerability happens.
I prefer to add a good dependency and having to deal with it rather than writing broken code and fixing it later. Of course I'm not talking about a 5 lines dependency, but real features.
Illustrative anecdote: this Friday I copy-pasted a little snippet of HTML/CSS code from an existing (and shelved) project. I've noticed for some time an icon in it wasn't displaying anymore, but this time I really needed to fix it. Turned out that the glyph icon where from a font used by Bootstrap, which was not available freely anymore. Bootstrap (my direct dependency) had itself that third party dependency that I thought was part of it. When they pulled the plug, my code broke.
I'm more careful about dependencies than I was a few years before. Often, if a peripheral thing can be done in an "ugly" way but allows me to avoid an external dependency, I'll wrote code myself.
“My point today is that, if we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent': the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger." - Djikstra
In an age of public bug databases and Stack Overflow, it’s pure ego trip to think that your handwritten solution is going to be better than an OSS solution or stay that way. If you reached for hand-written once, you’ll probably reach for it again and again and the older bits you wrote will be eclipsed by progress on those libraries. I’ve seen it many times before, I’m living it right now.
It’s vendor lock-in with you as the beneficiary. A sports coach would call you a Ball Hog. Let other people play.
You can run a perfectly respectable project with about 10% “special sauce”. That includes the bits that simply nobody has, and the exceptions to my advice above. You can sustain a small number of hand written replacements on par with existing libraries. And the team can absorb the Bus Number effects of that much code.
And “about” means “about”. If you are less, a competitor might steal your lunch. If you’re higher, you should be reflecting on why and asking if you really do still need all this stuff. Maybe that library you looked at before finally got the feature you needed.
I think that's as much true of external dependencies as it is of ones that you wrote for yourself. With the exception that your own solution is probably smaller, much smaller, because it only ever needed to solve your immediate needs and not everything else a third party had to deal with.
So it's quite possible that the internal solution is more approachable when the time comes to debug it.
Personally I’d rather be mad at someone I’ll never meet. It makes meetings a lot more pleasant.
Let's take the example of someone who wrote their own Perl ORM and Object Model then.
> You'll save yourself (and others) headaches in the future.
Or it'll hamper development on the system when you leave because nothing works how people expect, it's too complex for people to pick up and modify, and trying to do anything with it causes the entire structure to creak because it's EVERYWHERE.
The larger and more complex a system you design, the more likely it is that you end up with something breaking because two dependencies are incompatible or even your code and a dependant break due to updating the dependant.
Further, security is rarely considered. The more code you have, the more likely you are to have a security vulnerability. You have to worry not only about code you maintain, but also the code of your dependencies.
If you can write the functionality you crave rapidly, do it. You'll save yourself (and others) headaches in the future.