paint-brush
How to Decide Which Packages to Useby@alexaitken

How to Decide Which Packages to Use

by Alex AitkenApril 2nd, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

At my current company (Agoda), we don’t have a strategy for picking what packages that we use (that I know of). Mostly, you have to prove that installing this package is useful and that it wouldn’t make sense doing it ourselves. We don’t want packages that will increase our bundle size (for <a href="https://hackernoon.com/tagged/javascript" target="_blank">javascript</a>) as that would increase the load on customers and that’s not a good thing. To prevent that, we have a <a href="https://beerandserversdontmix.com/2018/01/06/comparing-webpack-bundle-size-changes-on-pull-requests-as-a-part-of-ci/" target="_blank">bundle size checker</a> in pull requests. So, how do you decide which packages to use?

Company Mentioned

Mention Thumbnail
featured image - How to Decide Which Packages to Use
Alex Aitken HackerNoon profile picture

At my current company (Agoda), we don’t have a strategy for picking what packages that we use (that I know of). Mostly, you have to prove that installing this package is useful and that it wouldn’t make sense doing it ourselves. We don’t want packages that will increase our bundle size (for javascript) as that would increase the load on customers and that’s not a good thing. To prevent that, we have a bundle size checker in pull requests. So, how do you decide which packages to use?

Do you need it?

Sometimes people include packages that they could’ve written themselves in two lines. What I’m really trying to say is that you need to think if this package is really necessary. Do they have complex logic (that’s tested) that would add a lot of time to your development? Have you looked into the bundle size and what it’ll add to your bundle? Do you need all the functionality that the package offers? Or are you only going to be using such a small part of it? These are things you need to consider before considering it.

How active is the community?

Are you downloading the most active package or one that the author hasn’t committed to in a few years? These types of things should also have an effect on your decision. I always look at the community because you need to know that if there’s a bug — will you be able to ask for a fix or fix it yourself? Will they check your pull request? For things like which framework you’ll use (i.e. React, Angular etc), I check how many people are talking about it. How many plugins or extensions are there? Will they have everything you need?

Is it right for the project?

I know you want to use the newest and shiniest technologies. You want to use React, Vue, or maybe even Angular. But you’re only building a simple page with a scroll animation. You probably don’t need these web frameworks. You need to ask yourself, what does this project really require? Am I building a SPA? What package best fits? Should I use multiple smaller packages or one that has everything? You need to look at what’s right for the project and not what’s the coolest.

What have I learnt?

I hope you’ve learnt something from this. The main thing is that you need to think before including packages. Not every package will be needed. Not every cool framework should be used. Look at how active the community is. Let me know if/what is your decision tree for choosing new packages. I’d love to hear and improve.

Originally published at www.alexaitken.nz on April 2, 2018.