3 ms·
I used to be in the "implement from scratch" side, but these days my position is a lot more "it depends". My approach to deciding if using an external library
by mrighele 7y ago
I used to be in the "implement from scratch" side, but these days my position is a lot more "it depends".
My approach to deciding if using an external library or write the code goes more or less as follows:
a) Limit yourself to a few big libraries that are widely used and well supported.
Especially if you work with a language where it is trivially easy to publish a new library, let's say javascript, you will find that even if you are just an average programmer half of the libraries you have access to have worse code that you would have written (so your point 1. is not necessarily correct)
Also using a library has a number of costs with it: increase in code size, time wasted updating it when needed, learning how to use it, understanding its documentation (if there is any at all), understanding why it doesn't behave how it is supposed to, checking github for bugs not yet fixed, etc. (so the effort spent in your 2. point is not necessarily bigger)
This cost is reduced is the library is a quality one, and also if you use a good amount of it, so my second point is
b) try to avoid a library if you just you need to use little of its functionality
Not only it may be cheaper to re-implement the part that you need, but adding a whole library means that you give charte blanc to other developers to use all the other parts of that library. This may be something that you want to avoid, expecially if the library has varying quality and not all parts are well-written. On the other side, if you know that you will probably need other parts in the future, it may be better to use the library instead.
My third rule is
c) keep in mind your team
If most people in your team already know a library, the cost of using it is greatly reduced. On the other side, if it new for most of them, it may be easier for them to maintain custom code (relates to your point 3.).