back

by anderspitman·7y ago·view on hn ↗
My rule of thumb when considering adding a dependency these days is to start by trying to implement the functionality myself. But I don't let myself spend too much time on it (maybe an hour or two. maybe a day). More often than not I'll get bogged down pretty quickly and realize the problem is more complicated than I assumed. This approach gives me:

1. Greater appreciation for the dependency

2. Better chance of modifying the dependency when it breaks or doesn't work the way I want, because I'm at least somewhat familiar with the types of tradeoffs you have to make to implement such a thing.

3. A chance that the problem turns out to be simple enough to not require a dependency and the prototype works just fine forever.

4. Get to learn something new.

Obviously there are exceptions. I wouldn't try to implement a relational database just because I need one. But in these situations I try to take a step back and ask if I even need a full DB. Would flat files work fine for the task at hand?

1 comments
I second this approach which is what I do as well. My baseline is that I prefer to not have any dependencies. This is usually not realistic nor necessarily pragmatic in practice (i.e. reinventing a relational database), but its a good baseline.

My general feeling towards dependencies (in programs or life) is "do I really want to depend on this thing?" Almost always the answer should be "no". But the follow-up is "do I really need to depend on this thing?" and sometimes the answer is yes because I don't want to or can't re-implement the thing due to time or because I don't have the expertise.