Usage area of Javascript framework and libraries

In general, are activities such as slider and animation with libraries such as owlcarousel preferred in projects? or pure Javascript? Why is this preferred if pure javascript is preferred, and why is it preferred if it is the other option?

Sure, there are advantages to doing it yourself - easily customizable, easily optimized, etc. But the advantage of using a premade one from a library is that it is code that is (usually) well written and is maintained - if you choose well it is probably better written than what you will have time to do. Assuming it is a mature library, it has been crowd tested by many, many other devs and problems have been found.

Which is preferred? I think all the end user cares about is that it works well. Unless I have a specific reason, I’ll usually look for a library. If it’s something simple I might implement it myself, but in general, I’d rather use someone else’s tried and true work.

2 Likes

Thanks for your answer! I will have one more question, will there be any disadvantage to the speed of the site doing this? Also, do we choose these libraries / frameworks ourselves to use when working in a company or do we prefer what we are told?

will there be any disadvantage to the speed of the site doing this?

Maybe. It really depends. There are tiny little libraries that aren’t much bigger than what you would build - heck, it might even be better. And then sometimes there are huge libraries. Often they will let you just import what you need or treeshake out what you don’t, but it is something to think about.

Also, do we choose these libraries / frameworks ourselves to use when working in a company or do we prefer what we are told?

It depends. If it is a brand new project there might be some flexibility. Your freedom may also depend on the size of the team and the lead of the CTO. I’m working on a semi-mature project now. I recently needed to add a feature. I needed a functionality that wasn’t available. First I checked to confirm that there was nothing already existing in the app that did that. There wasn’t. Next I checked a similar app that the company has and found a library that they were using that did what I needed. I confirmed that the library did exactly what I needed and that it was mature and maintained. Based on that, I added it to the project. I made a note in the PR for people to confirm that that was the right move (I’m still new on this team.)

So, it really depends. If it was something new, I might have done a spike (investigation) of various packages and come up with a suggestion for the team.

It really, really depends. I’m always nervous about adding a library. But if it’s small and does the job, why not. If it’s huge and complicated and may create issues, I’m going to talk to my team about it. There is a lot of gray area in between.

2 Likes

Thank you you answered the questions in my mind. This topic scares me immensely. Even though I develop some projects myself, issues such as how to use the framework / libraries to be used while working in a company are always a question mark in my mind.

I wouldn’t worry about it too much. As you your projects, do what you want and realize that you’re going to make some mistakes. Heck, I’ve been on a team of amazing devs that made a big library mistake. It happens.

And when you’re on a team, you can talk it out.

It’s something to be aware of, but also don’t panic.