DEV Community

Cover image for How You Can Find Good Libraries For Your Projects
Milecia
Milecia

Posted on • Edited on

How You Can Find Good Libraries For Your Projects

When it comes to your choices for libraries, there's both too many and not enough to choose from. There are too many for any single person to look through and not enough that you would feel comfortable trusting. So how do you know which ones are the good ones? Here are a few things to consider when you're picking libraries for your project.

How long has the library been around?

Everybody knows about the tech boom that's currently happening. This is basically like the new Gold Rush. That's why you have to check how long a library has been around. There are so many new ones that pop up every day and I know there are some great ones hidden in them. Although when it comes to a project you're doing for a client, you can't afford to experiment much.

You need something that you know works. Maybe in a few years that new one will have proven itself to be great, but right now you need something with a little history. Look at reviews and comments. See what people have been saying about the library over the past 2 years and you can get a feel for what you'll get by using it.

When was the last update?

This is one of the things you have to watch with libraries that have been out for a while. Sometimes you think you’ve struck gold only to find out the last time anybody touched it was in 2009. It sucks even more if you didn't check before you used the library in your project and now everything's broken because it's written in something that doesn't exist anymore. Not like that's happened to me…

Anyways, you want to make sure that there is at least one update in the past year. Preferably in the past 6 months, but sometimes libraries don't need to be updated every few months. As long as you can see someone is keeping the code from turning into a history lesson then it should be good to use.

Is it compatible with your project?

You have to make sure that the library is in the right language for your project. I know that sounds dumb and it doesn't seem like something people wouldn't check, but it happens. You can get caught up in the beautiful description of a library and forget that it's in C++ and you're using JavaScript.

It's deeper than just checking for language compatibility. Is it the right version for your project? Does it use the right syntax or is it dated? You can stumble upon the perfect library for the oldest version of project, but that doesn't help you. You need the library that works with your version or else strange things will happen and they'll probably happen at just the wrong time. So make sure the library matches up with what you're using.

Is there good documentation?

No matter what you do, you can't get away from documentation. If you’re about to use a library for the first time then you'll need some good documentation. To start with, can you find any documentation? It's a bad sign if you can't find anything from the people who made the library. You might have to learn how to use it through sheer willpower.

Finding a library with good documentation is a must. When you get those weird errors that seem to happen for no reason and you know the rest of the code was fine before, that documentation will help you fix those errors. When you want to push the library a little further than it comes out of the box documentation in crucial. You need it!

Is there a community around it?

It doesn't matter how great a library is, there will always be that one freak problem that you seem to find and only 3 other people know about it. Can you find those 3 people though? A healthy community is sign that a library is going to have good support. Even if the people who made the library stop supporting it, a healthy community will usually take it over.

Plus it's always good to have a specific place to go where other people can help you debug your code. We've all had that one person on Stack Overflow help save our lives. That's what you want to see happening in a community.

What are the close alternatives?

Everything has some kind of alternative. In the world of libraries, you could easily find 1,000 libraries doing the same exact thing. They just do it slightly different. That's why it's good to look at a few other libraries once you find one you kind of like. It could turn out that the library you like is exactly what you need, but looking at 1 or 2 others will make you more confident in your decision.

Looking around takes a little extra effort, but believe me, it can save you days of work and some embarrassment. Don't go too far down the rabbit hole though. Look at 1-3 alternatives and make a decision. The absolute worst thing that will happen is you have to revert your project back to a different revision. Make sure you commit everything before you download that new library!

If you look into these things you'll be more likely to find some good libraries that you can use for years. Don't be afraid to try out a few of them to see how they really work in your project. That's what GitHub is for. One thing that took me a while to find was a good datetime library. It's crazy how complex time zones are. What are some libraries you've used to make your projects better or easier?


Hey! You should follow me on Twitter because reasons: https://twitter.com/FlippedCoding

Top comments (3)

Collapse
 
jvanbruegge profile image
Jan van Brügge

Another important thing is: Do you unterstand how the library works? You cannot treat libraries as black boxes, things will break at some point in time. To be able to fix it, you need to understand how the library is doing its job.

Collapse
 
mkenzo_8 profile image
mkenzo_8

It's sad when you want to watch some tutorial about how to use some library but all videos use an older version and documentation is a mess 😢

Collapse
 
mariosk profile image
Marios Karagiannopoulos

Nice article Milecia! Don't forget to add one more section about licensing. It's a common mistake to not read the license rules of the libraries we use.