Why Do Developers Use Trivial Packages?
Reviewed by Greg Wilson / 2021-09-17
"Reduce, re-use, recycle" is probably the most useful advice someone can give a young programmer, but is it possible to take re-use too far? In particular, is it worth creating and sharing a library that contains only one small function? Conversely, is it sensible to use such micro-libraries?
Developers only major concern with using trivial packages was the dependency overhead. However, the authors found that, "Contrary to developers' perception, only 45.2% of trivial packages actually have tests." Instead, their reliability comes from being "deployment tested", i.e., so many people use them that meaningful edge cases are found and fixed relatively quickly.
So should developers use trivial packages or not? I think that framing misses the point. Developers do use trivial packages; telling them not to is as vacuous as saying that abstinence will solve the problem of teenage pregnancy. What researchers can and should do is identify situations where using those packages is sensible and help people do it better and more safely. It would be fascinating to see this work repeated for other languages, particularly ones like Python that are primarily used for server-side work.
Abdalkareem2017 Rabe Abdalkareem, Olivier Nourry, Sultan Wehaibi, Suhaib Mujahid, and Emad Shihab: "Why do developers use trivial packages? An empirical case study on NPM". Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, 10.1145/3106237.3106267.