Mixing Javascript libraries in a project

7

I wonder if it's not good practice to load several different Javascript libraries into one application.

For example, the project has an X deadline for delivery, but should be done in AngularJS but the developer knows more about jQuery which makes project development faster. Over time it acquires knowledge about directivas of AngularJS and resolves to include this library in the source code along with jQuery and replacing a certain business rule with the layout that could do with jQuery and now implemented with AngularJS. >

When is it recommended to do this? Why not do everything using AngularJS or another library? Any article that addresses this or a good reasoning answer?

    
asked by anonymous 20.09.2015 / 00:12

2 answers

9

Angular is a framework, jQuery is a library. The two can coexist in the same project peacefully.

The problem is if you want to use two frameworks or two libraries that serve the same purpose.

For example, the combinations below would not be recommended:

  • Jquery and Zepto
  • Angular and Ember
  • Google Maps and Leaflet

You may even see projects that do this kind of combination, but that's a sign that the rest of the code is likely to be pretty messy and difficult to maintain.

  

Edit:

     

Just to complement: In practice, a web project in production typically   to use dozens (in some cases, even hundreds) of libraries at the same   time. A framework is nothing more than a collection of libraries   made to work together.

     

It is recommended that you use a package manager for your   project, such as Bower, to keep their libraries organized.

    
20.09.2015 / 00:20
1

I would open a similar topic so I'll leave my opinion here.

This depends a lot on the frameworks involved.

Jquery + Angular: Not a good practice

angular is a reactive framework. Internally it uses a timeout that looks at the scope variables. Whenever something changes it refreshes the page with content. You do not access the DOM directly and use the single page concept which greatly improves application performance.

jquery has a totally different approach. It uses DOM access to retrieve and set information. This access is not recommended due to loss of application performance. I will not go into the merits of how it works because I would be dealing with a topic that is not about the topic.

React + Jquery: Not good practice

react is a template-oriented framework. It also has the concept of single page and is reactive as the angular. I do not consider it a good practice precisely because the framework itself already has everything you need. In addition it is lighter than the angular because its core is smaller. So it does not make sense to include another js framework to do something that react already does.

React + Angular: Not a good practice

Even though both are reactive and using concept single page the structure and form of development is different. Mixing both can generate a fruit salad that will be more confusing than helping. It is worth remembering that angular development is particularly fast and has more features. However the react is lighter in addition to being used and maintained by facebook. I do not even need to dig deeper to say it's a good choice, too.

In summary

These are some of the top frameworks available on the market. The ones I quoted are heavily used in the front-end community, have good documentation with several examples available on the net. So you do not have to use more than one.

I know how the IT market works. Delivery pressure and etc. Most change the course of the project because someone does not know of the resource used is a team problem. If you are a programmer you have an obligation to know all the technologies used by the team precisely so as not to have this type of problem. Now if it is a bean with rice and the company accepts it is because the company is not focused on the quality of source code and later on the quality of the project for the client.     

24.12.2015 / 17:14