Ask HN: How do you decide when to use a library?

3 points by niels_olson ↗ HN
I'm teaching myself bioinformatics and have some knowledge of the major libraries (eg, scikit-bio and biopython). I'm finding it helpful to lean on the libraries sometimes, but then I'll feel guilty and go back and rewrite those sections from primitives. Is this a normal pattern of behavior?

3 comments

[ 5.8 ms ] story [ 19.9 ms ] thread
In general libraries are there to make your life easier and help speed up development so you don't reinvent the wheel. The issue is then that you have a dependency, so you have to be able to manage that going forward(including testing other versions usually). In my experience, people normally use libraries pretty heavily and don't rewrite the functionality using primitives unless there is a real reason that everything needs to be standalone(such as writing embedded software where there are space or other limitations).
I try to balance development time versus research and learning time. When you go to use a library, you have to consider the time it takes to determine which libraries exists to solve your problem and evaluate them to determine which matches your project best. Then, you have to decide whether the additional dependenc(y|ies)is worth the development time saved. Like everything else in software development, it's a balancing act. Having said that, as you get older, and have worked in the field longer, you find yourself less and less willing to reinvent the wheel and more willing to just use someone else's code.
When the risk of implementing something you come up with is greater than the risk of relying on something you didn't.

risk is measured as some combination of time and money. how they interact should depend on the specific project.