问题
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.
回答1:
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
回答2:
By your coworkers point of view, .NET and JAVA are for people who don't know enough assembly.
Frameworks exist for a reason. They allow you go focus on the problem instead of dealing with repetitive code. They allow you to be confident (assuming you use well tested frameworks) that certain pieces of your code are reliable and well tested.
If your coworkers are against frameworks, I would seriously consider moving on.
回答3:
Since no one has mentioned it - a Javascript framework rapidly becomes one more project dependancy, and in general terms, dependencies are bad as they represent points of failure.
As for this:
- Mainly for people that don't know enough JS
Without elaborating, I will say that if one of our team said something like that in my presence, I would try to shrug it off as a joke. If I thought they were being serious, I would probably have to kill them.
And as for this:
- Frameworks limit Javascript developers
That could translate to "Frameworks make it marginally harder to write spaghetti code, and that's what I do best"
Those are not arguments, they are excuses.
回答4:
A few positives for javascript frameworks (like JQuery).
- They provide standardization in ui elements.
- Reduce time to develop complex interfaces and effects.
- Normalize efforts by providing functions that are already cross-browser compatible.
- 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.
- 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.
回答5:
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.
回答6:
I'm surprised no one has already mentioned it:
- A lot of web developers default to using JQuery without considering the alternatives
- And end up including it on a web page to do a few trivial tasks which could easily be done in pure JavaScript
- The result is that users have to wait for the whole library to download and it slows down web browsing
Also:
- Some web developers get carried away with the design of web pages, and end up developing unnecessarily complex web pages because of the power of JQuery
- Just because JQuery enables you to create scripts with good cross-browser compatibility it doesn't mean that the end result is usable on different devices / interfaces
- I'd also argue the cross-browser compatibilty because I've seen instances of webkit not playing well with JQuery
- JQuery encourages "fast" scripting - but if you rush it you are likely to have missed something out
- Writing in JavaScript from scratch is slower - but I believe that you end up with a more complete solution which more closely matches the users needs
- Using JQuery can shift the focus of the web developer to creating web sites which are highly graphical and visually appealing, whereas the focus should be on functionality and usability
- JQuery is not a silver bullet for web development
I am biased here because I don't use JQuery, but it is because I haven't found a need for it yet - maybe it's because I focus more on usability and functionality rather than making the user interface look pretty (sorry I know JQuery can do more than that).
回答7:
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 .
回答8:
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.
回答9:
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.
来源:https://stackoverflow.com/questions/1242528/what-are-the-arguments-against-using-a-javascript-framework-for-a-web-site-devel