引言
自己一直在用MooTools框架, 偶然看见这篇文章,作者是MooTools Team的成员之一,讲解了jQuery和MooTools的一点点区别,主要是我觉得他写JavaScript代码和他的思维方式很值得学习。另外,对 JavaScript的编程思想和对框架的选择都有很多很好的建议,对于犹豫在各种框架上的人有很好的指导作用,另外对于想深入对框架进行研究或者想自己 开发框架的人也有很好的建议。文章虽然很长,但是我觉得不错,然后就翻译了。水平有限,文笔粗陋,其中有少数地方自己都觉得翻译得有些牵强,欢迎批评指 正。
译者:Fdream
译者博客:Fdream's Blog
原文:jQuery, MooTools, which is the most popular and well represented framework and What Really Makes One Framework Different From Another
标题:
jQuery, MooTools, which is the most popular and well represented framework and What Really Makes One Framework Different From Another
jQuery和MooTools,哪一个框架更受欢迎有更好的表现以及它们之间的真正区别是什么
I've been experimenting with several javascript libraries as well… the problem is finding the right mix of features… Ext.js is very extensive, but very large and complex: steep learning curve.
我一直在尝试一些不同的JavaScript库,试图找到一些合适的特性组合:Ext.js非常好扩展,但是太大太复杂,学习难度很大。
jQuery is very easy to learn, has some great features, but soon you start looking in the plugins database for much needed functionality that's missing in the official library. The plugin feature is great, but there's a downside as well… soon you get drowned by the number of available plugins, spending a lot time checking out which ones match the quality of the core library. It's a good thing some plugins get listed on the main site, but still, it takes a great deal of effort to find that right mix. I've been working with Microsoft Ajax library as well, but don't like their control extension framework (which is quite complex).
jQuery非常容易学习,有很杰出的特性,但是当你从插件库里去找更多的功能时,发现官方的库里面根本就没有。插件特 性非常好,但是也有很不好的地方……很快你就会被无数个可用的插件弄得晕头转向,你需要花很多时间去确定哪些插件才和核心库的质量相匹配。如果主页上列出 了这些插件还好,但是,还是要花费很大的力气去找到合适的特性组合。我也同时在使用Microsoft Ajax库,但是不喜欢他们的控件扩展框架(它们实在是太复杂了)。
So, I must first attest that hands down, jQuery was the most popular and well represented framework there. They ruled the roost. John Resig (creator of jQuery) spoke 7 times in 3 days, Microsoft demonstrated how jQuery is included in its SDK, and the crowd attending was definitely there to talk about the framework. More than anything, this made it clear to me that jQuery is doing something right.
因此,我必须首先很轻而易举地证明:jQuery是最受欢迎以及有更好表现的框架。他们是最 好的。John Resig(jQuery的作者)在三天里曾七次说:“Microsoft演示了怎样把jQuery包含进了它的SDK,出席会议的人也非常肯定地谈论了 这个框架。这些都清楚地让我看到:jQuery正在做一些正确的事情。”
Part of the task I set for myself in attending the conference was to attend as many of these jQuery sessions as I could both to learn as much of jQuery as I could (I have, in the past, dug into it, but I wanted to soak up as much as I could from the development team and John) and also to see if I could pick up on what accounts for the popularity of the framework.
我去参加这个会议的一部分任务就是尽可能多地参与jQuery的交流和学习(我曾经也很深入地学习过,但是我希望从开发团队和John那里学习到更多东西),同时也可以看一下我是否能够找到这个框架受欢迎的原因。
This requires a bit of explanation. The MooTools team (of which I am a part) has never really focused on how popular the framework is. We are interested in writing it for our own use and for its own sake, but we don't really spend much energy trying to convince other people to use it. We don't consider ourselves adversaries to other frameworks - as I've heard it put on numerous recent occassions, we're at war with the browsers, not each other. In my own posts on the topic, my suggestion to people is to try a couple of options and choose the framework that suits your needs and your styles. You really can't make a bad choice (so please stop arguing about it!). jQuery, Prototype. YUI, Dojo, MooTools - we're all doing the same things just using different methods. More on this in a little bit, because I've started to think about this more lately.
这里需要一些解释。MooTools团队(我也是其中之一)从来没有真正关注过这个框架有 多受欢迎。我们只是对写这个框架感兴趣,为我们自己使用和它本身目的去写,但是我们真的没有花很多精力去让其他人去使用这个框架。我们从不认为其它框架是 我们的竞争对手——因为我曾经在很多场合都听说过这样的话,我们在和浏览器进行斗争,而不是相互斗争。在我的这篇文章中,我给你们的建议是:多尝试一些选 择,然后选择适合你的需求和你的风格的框架。你真的不能做一个坏的选择(因此,请停止争吵!)。jQuery、Prototype、YUI、Dojo、 MooTools——我们都只是用不同的方法在做同样的事。关于这一点写得有点多,因为我最近一直在思考这个。