Re:Ask HN: When do you use a library vs. implement something...
by usrusr on Friday April 20, 2018 @03:43AM
(#16882897)
I'd add consistency to the benefits: when I need leftpad and declare a dependency on "big bag of string stuff" for it, chances are high that codevelopers will pick it up when they need rightpad. Because the very first step in every library decision is "do we already have a dependency for that". Bespoke implementations would tend to end up all over the place.
While I try to avoid premature abstraction, on libs that have high volatility or otherwise don't score very high, I'll put a thin interface layer between my use and the true impl. This saved me recently as I had a Scala trait abstract the async Postgres client lib I was using, then I hopped from one to another to another over a couple of years until just recently writing one because the others sucked for various reasons. Just make sure you have integration tests and you'll feel comfy in your choice.