javascript 使用 extjs 的优缺点是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8117592/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are pros and cons of using extjs?
提问by Anoop
In one of my project someone has recommended me to use extjs. I know very little about extjs. I have done my all the project using jQuery. I know many of you know about extjs very well.
在我的一个项目中,有人推荐我使用 extjs。我对 extjs 知之甚少。我已经使用 jQuery 完成了我的所有项目。我知道你们很多人都非常了解 extjs。
please tell me the pros and cons of using extjs?
请告诉我使用 extjs 的优缺点?
采纳答案by AlphaMale
Following are some of the major pros and cons of ExtJS:
以下是ExtJS 的一些主要优点和缺点:
Pros
优点
ExtJS is like a superset of the widgets like simple label, textBox buttons to complex grids, drag-drop panel s etc. It also provides demo for remoting to invoke remote server methods.
It has quite good documentation with tutorials, samples and user community.
Active and currently most adopted javascript RIA framework
Good code quality/readability
Amazing set of widgets, does everything we could possibly want. Seems quick, every version brings new improvements.
ExtJS 就像简单标签、文本框按钮到复杂网格、拖放面板等小部件的超集。它还提供了用于远程调用远程服务器方法的演示。
它有很好的文档,包括教程、示例和用户社区。
活跃且目前采用最多的 javascript RIA 框架
良好的代码质量/可读性
一组惊人的小部件,可以做我们可能想要的一切。看起来很快,每个版本都带来了新的改进。
Cons
缺点
Footprint - The library is 500 KB in size (using mod_gzip could be reduced to 150KB). Loading time would is high for home page on web.
CSS – very easy to get lost. It is difficult to find correct class names
HTML – full of divs and overly complex generated code. Difficult to debug even with FireBug.
Modified GPL 3.0 licensed. Free for open source applications but paid for commercial closed source applications.
Using ExtJs leads us to believe that the GUI would kind of desktop and rich. Customization is not easily achievable.
Loading even simple things requires few lines of coding which is simpler in plain html or jQuery.
Debugging is not very easy. Only GWT has bit better debugging in hosted mode among javascript frameworks.
It is not possible for the user to bookmark a certain page . Since the objects are rendered by DOM manipulation, page can not be indexed by search engines
Need quite experienced developer.
I'm not sure how to use this without the entire display being EXT. I would prefer something that could integrate into what we already have.
占用空间 - 库大小为 500 KB(使用 mod_gzip 可以减少到 150KB)。网页主页的加载时间会很长。
CSS – 很容易迷路。很难找到正确的类名
HTML – 充满了 div 和过于复杂的生成代码。即使使用 FireBug 也难以调试。
经修改的 GPL 3.0 许可。开源应用程序免费,商业闭源应用程序付费。
使用 ExtJs 让我们相信 GUI 会是桌面和丰富的。定制并不容易实现。
加载即使是简单的东西也需要几行代码,这在纯 html 或 jQuery 中更简单。
调试不是很容易。在 JavaScript 框架中,只有 GWT 在托管模式下有更好的调试。
用户不可能为某个页面添加书签。由于对象是通过 DOM 操作呈现的,因此页面无法被搜索引擎索引
需要相当有经验的开发人员。
我不知道如何在没有整个显示为 EXT 的情况下使用它。我更喜欢可以整合到我们已有的东西中的东西。
Reference: ExtJs - The Pros and Cons
参考: ExtJs - 优点和缺点
Hope this helps.
希望这可以帮助。
回答by Brian Moeskau
Although the previous answer was already accepted, there are a few points I'd like to clarify.
虽然之前的答案已经被接受,但我想澄清几点。
Ext does not use a "modified" GPL license. It is fully dual-licensed under the standard GPL v3 and the Sencha Commercial License. There are FLOSS exceptionsto make it further compatible for plugin/extension developers, etc., but the GPL license is the standard license.
Ext 不使用“修改过的”GPL 许可证。它在标准 GPL v3 和 Sencha 商业许可证下完全双重许可。有FLOSS 例外,使其进一步兼容插件/扩展开发人员等,但 GPL 许可证是标准许可证。
The list of Cons, while mostly fair points in general, is somewhat meaningless without some context. Comparing Ext JS to jQuery is also meaningless -- that's comparing apples to oranges. If you compare Ext JS to other comparable RIA frameworks (Dojo, YUI, Sproutcore), then things like footprint, CSS/HTML complexity, debugging, etc. become pretty even (or at least a more useful contrast can be made). Just saying that those things are "cons" in the abstract is not really accurate, since they are mostly just requirements of any complex RIA framework.
缺点列表虽然总体上大部分是公平的,但如果没有某些上下文,则有些毫无意义。将 Ext JS 与 jQuery 进行比较也毫无意义——这是将苹果与橙子进行比较。如果您将 Ext JS 与其他类似的 RIA 框架(Dojo、YUI、Sproutcore)进行比较,那么诸如占用空间、CSS/HTML 复杂性、调试等内容就会变得相当均匀(或者至少可以进行更有用的对比)。仅仅说这些东西是抽象的“缺点”并不准确,因为它们大多只是任何复杂 RIA 框架的要求。
Regarding a few specific points, this list (according to the source article) references Ext 3.0. The current version as of this writing is 4.0.7. The total code footprint has actually increased since 3.0, but Ext now ships with a dynamic class system and build tools that allow you to create optimized builds based on your application's dependencies. So yes, it has a large total footprint, but no, you do not have to include everything.
关于一些具体点,这个列表(根据源文章)引用了 Ext 3.0。撰写本文时的当前版本是 4.0.7。自 3.0 以来,总代码占用空间实际上有所增加,但 Ext 现在附带了一个动态类系统和构建工具,允许您根据应用程序的依赖项创建优化的构建。所以是的,它的总占用空间很大,但不,您不必包括所有内容。
CSS/HTML complexity is a given, based on the complexity of the widgets and the layout systems supported by Ext JS. This is very common in the world of RIAs and not comparable to simple jQuery plugins. Ext 4.0 now uses SASS/Compass btw, with generated CSS, so customizing the source styles is actually much easier now than in 3.0.
CSS/HTML 复杂性是给定的,基于小部件的复杂性和 Ext JS 支持的布局系统。这在 RIA 世界中非常普遍,无法与简单的 jQuery 插件相提并论。Ext 4.0 现在使用 SASS/Compass 顺便说一句,带有生成的 CSS,因此自定义源样式实际上比 3.0 现在要容易得多。
Debugging is also somewhat easier in 4.0 (again due to the new class system) but is certainly harder than any statically-typed language like Java (GWT). This is an issue for any JavaScript based frameworks, not just Ext.
在 4.0 中调试也更容易一些(再次由于新的类系统),但肯定比任何静态类型语言,如 Java (GWT) 都难。这对于任何基于 JavaScript 的框架都是一个问题,而不仅仅是 Ext。
It is certainly possible to bookmark pages in your app if you implement history/state support (both offered by Ext). This is something you must do since it is app-specific (there is some automatic state management at the individual widget level) but it's certainly possible. Again, this is a common RIA issue, not anything specific to Ext.
如果您实现历史/状态支持(均由 Ext 提供),当然可以在您的应用程序中为页面添加书签。这是您必须做的事情,因为它是特定于应用程序的(在单个小部件级别有一些自动状态管理),但这当然是可能的。同样,这是一个常见的 RIA 问题,而不是任何特定于 Ext.
The list of Pros I would agree with (except point 5 which is presented out of context and makes no sense). In fact the documentationand help guides have gotten way, way better since version 3.0. If you want specific comparisons between Ext JS and other RIA frameworks, just search SO as that's been well coveredbefore.
我同意的 Pros 列表(第 5 点除外,它是断章取义且毫无意义的)。事实上,自 3.0 版以来,文档和帮助指南已经变得更好了。如果您想在 Ext JS 和其他 RIA 框架之间进行具体比较,只需搜索 SO,因为之前已经很好地介绍过了。
回答by dbrin
What you are trying to do with the framework is going to determine which one to use.
您尝试使用框架做什么将决定使用哪一个。
ExtJS
扩展程序
is great for a single page RIA application where ExtJS framework is loaded once on the page with next to 0 hand coded HTML.This means that the framework manages EVERYTHING in your application.
非常适合单页 RIA 应用程序,其中 ExtJS 框架在页面上加载一次,旁边有 0 个手工编码的 HTML。这意味着该框架管理您的应用程序中的一切。
JQuery
查询
use case is much different: your server side framework generates HTML (via JSP, GSP, ASP, whatever) and you add functionality to those pages by including JQuery library to each one.
用例大不相同:您的服务器端框架生成 HTML(通过 JSP、GSP、ASP 等等),您通过在每个页面中包含 JQuery 库来向这些页面添加功能。
ExtJS Cons:
ExtJS 缺点:
- Complex framework - not for the faint of heart :)
- Steep learning curve
- There are bugs - yes there are. However, most issues arise from not using the framework correctly and not understanding the documentation thoroughly enough.
- Evolving framework - this can be viewed as both + and - but there has been ~7 releases this year.
- 复杂的框架 - 不适合胆小的人:)
- 陡峭的学习曲线
- 有错误 - 是的。然而,大多数问题都是由于没有正确使用框架和对文档的理解不够透彻。
- 不断发展的框架 - 这可以被视为 + 和 - 但今年已经发布了大约 7 个版本。
ExtJS Pros:
ExtJS 优点:
- Truly versatile client side MVC framework with the most complete set of components and widgets currently available.
- Extensible. Literally Ext.extend() is the first thing you do.
- Beautiful. Out of the box theme is so well designed that most devs with no theming skills ( we are not pointing any fingers) can create truly professional and good looking web apps.
- Documentation is by far the best I have seen of any library, API, or open source project. Complete with API docs (even though some holes are there) with live code samples you can tweak and see what happens + source code. Great examples spanning most of the library. Excellent guides on most important topics from MVC to Theming. Even a video library. This documentation has been greatly updated recently so if you have not seen in the last 6 months - well, go look!
- Forums are very much alive with many key experts actively participating on daily basis.
- User Extensions (UX) - a large user community leads to an amazing array of creative solutions.
- It's giant! It has so many great components that I have not had a need to truly extend something beyond recognition. Did I mention the learning curve?
- MVC - for any self respecting RIA app MVC framework is a must
- Built tools
- Theming support with SASS and Compass
- ... there is much more.
- 真正多功能的客户端 MVC 框架,具有当前可用的最完整的组件和小部件集。
- 可扩展。从字面上看 Ext.extend() 是您要做的第一件事。
- 美丽的。开箱即用的主题设计得非常好,大多数没有主题技能的开发人员(我们不是指指点点)可以创建真正专业和美观的网络应用程序。
- 文档是迄今为止我见过的任何库、API 或开源项目中最好的。完整的 API 文档(即使存在一些漏洞)和实时代码示例,您可以调整并查看会发生什么 + 源代码。跨越大部分图书馆的伟大例子。从 MVC 到主题的最重要主题的优秀指南。甚至是视频库。该文档最近已大大更新,所以如果您在过去 6 个月内没有看过 - 好吧,去看看!
- 论坛非常活跃,许多关键专家每天都积极参与。
- 用户扩展 (UX) - 庞大的用户社区带来了一系列惊人的创意解决方案。
- 它是巨大的!它有很多很棒的组件,我没有必要真正扩展一些超出认知的东西。我有没有提到学习曲线?
- MVC - 对于任何自尊的 RIA 应用程序来说,MVC 框架是必须的
- 内置工具
- SASS 和 Compass 的主题支持
- ......还有更多。
disclaimer: I am a former frustrated ExtJS developer who is finally high enough on the learning curve to really enjoy it :)
免责声明:我以前是一名沮丧的 ExtJS 开发人员,他终于在学习曲线上达到了足够高的水平,可以真正享受它:)
- (open to as a community wiki )
- (作为社区维基开放)