What are the arguments against using a JavaScript

2019-03-20 21:05发布

Our company builds websites and web applications. We are a small firm and our team of developers are always building the javascript functions from scratch or copying from other websites built by us. Every time I bring to the table the word standardization and using a JS framework like JQuery, Prototype or any other, I am told Frameworks have the three points below as arguments against them:

  • Mainly for people that don't know enough JS
  • Frameworks limit Javascript developers
  • Frameworks bloat the actual development code with a lot of things that are not used.
  • We don't use enough Javascript in our applications for us to need JS framework

In my mind it seems that Frameworks, give our team a good starting point, documentation, a community and always the option to grow on top of the framework. Could some Framework users elaborate further?

EDIT 1:

Thanks to all of you for your great responses. I really did not think that this was going to be such a hot topic. I am glad I asked the question. I posted another similar question in the following link in case you might think you want to add something. The topic of the new question is CSS related. Thanks.

9条回答
迷人小祖宗
2楼-- · 2019-03-20 21:11

There are plenty of good reasons to be suspicious of frameworks in general, balanced of course by lots of reasons why they are worthwhile.

I use jquery now, and frankly within an hour of learning it realised that it fits the job so well that if it didn't exist I'd only end up reimplementing something very similar myself, only it wouldn't be as good or as cross platform.

There isn't much bloat there, it's very small and well designed and does nothing at all that stops you writing any javascript you want for specific cases that don't fit your needs.

查看更多
你好瞎i
3楼-- · 2019-03-20 21:12

I liked the answer of pb +

Mainly for people that don't know enough JS

I believe it is too complicated for them, so they use this excuse. FW allows you to build much more complex applications.

Frameworks limit Javascript developers

bullshit

Frameworks bloat the actual development code with a lot of things that are not used.

what is it today extra 100k-200k? especially if you use the CDN versions (at google for instance). And this is assuming you use nothing in the FW.

查看更多
贪生不怕死
4楼-- · 2019-03-20 21:18

An argument against libraries is BROWSER SUPPORT most libraries support only a subset of browsers out there . Here is an example of BBC rolling out their own instead of using something like jquery .

查看更多
一夜七次
5楼-- · 2019-03-20 21:21

Arguments against:

  • Frameworks prevent you from re-inventing the wheel
  • Frameworks generally contain well tested code
  • Frameworks are well supported by the community
  • Frameworks force you to focus on the business problem you're trying to solve

</sarcasm>

  • Frameworks may have a license you don't agree/can't work with
查看更多
迷人小祖宗
6楼-- · 2019-03-20 21:22

A few positives for javascript frameworks (like JQuery).

  1. They provide standardization in ui elements.
  2. Reduce time to develop complex interfaces and effects.
  3. Normalize efforts by providing functions that are already cross-browser compatible.
  4. Due to efforts in cross compatibility documentation is more useful in a framework as you can use the framework's api as canon instead of searching for obscure support for various/proprietary javascript functions.
  5. Reduced learning curve for new developers making them productive on your software quicker.

I completely disagree that a framework limits javascript developers. Quite the opposite actually. Most frameworks provide extensive plug-in mechanisms where the framework can be extended using raw javascript utilizing hooks in the framework itself.

查看更多
不美不萌又怎样
7楼-- · 2019-03-20 21:23

I'll use jQuery as an example, but what I'm saying here could apply to most JavaScript frameworks.

Many frameworks (notably jQuery) are far too monolithic and not modular enough.

While depending on well-tested 3rd party software is often more than justified, "frameworks" tend to give you a lot more functionality than you need at the moment.

In many projects, I very much like the convenience that jQuery gives me for selecting sets of elements (using $(".classname"), for example). But, if I'm not using any significant amount of AJAX, I don't need the AJAX utilities provided by jQuery.

Software should do one thing and do it well, and software written in JavaScript is no exception. Most of the frameworks you refer to try to do everything, resulting in unnecessary complexity.

One place this can bite you is when you're considering upgrading to the next version of the framework. That involves crawling through jQuery's changelogs for backwards-incompatible changes and searching your project for areas where that code is used. This can be quite a nightmare, especially if you don't necessarily have a comprehensive list of which jQuery features you use and which ones you don't.

Also, jQuery (and other frameworks) tends to cause developers to start depending on new features of jQuery without even thinking about it, making it harder to determine which features of jQuery your project uses and which it doesn't.

If you use a utility which does one thing, then you know exactly which features of that utility you're using. There's only one. (If you aren't using that utility at all, it's easy to determine. Such a determination would mean you could safely remove it from your project.)

I'm all for using well-tested 3rd party code. But if it tries to do too much, (that is, if it's a framework rather than a utility), you should probably look for an alternative. If it tries to do too much (like jQuery tries to do too much), then it's got some serious, foundational design flaws that will probably come back to bite you.

查看更多
登录 后发表回答