论坛首页 Web前端技术论坛

Dojo vs YUI / YUI-EXT vs Prototype / Scriptaculous vs Mochi

浏览 14403 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-03-08  
关于 

Dojo vs YUI / YUI-EXT vs Prototype / Scriptaculous vs Mochikit vs JQuery

的比较!

作者的建议是现在最好的选择是用yui-ext

dojo 虽然有ibm的支持,但是目前不是很成熟!
   发表时间:2007-03-08  
建议不要用dojo。 现在项目中用dojo搞死人了。用用dojo的event io之类的还是可以。 widget千万不要用。
0 请登录后投票
   发表时间:2007-03-10  
就凭Dojo这个名字(一种日本文化元素,日本传统相关的,相扑学校还是什么的),我就会避而远之。

还有他的风格,一个让人郁闷的前缀:Dojo。
而且一旦用了他,那么你的每个脚本中隔不了几行就得叫声Dojo。

生怕别人不知道你再用他的框架似的。

侵入严重,以后想从这个框架里面迁移出来,更是问题。
0 请登录后投票
   发表时间:2007-03-10  
呵呵,看看这个吧。
Ajaxian.com创建人Dion Almaer的一个访谈:
http://www.infoq.com/interviews/Dion-Almaer-Ajax;jsessionid=B7DEED54515D0917DF0FCBBD6F4DF040

注意看一下这个问题:
So tell us a little about the JavaScripts frameworks, how do they work and what is the best one out there?

Dion的回答:
Yes, so I mentioned the Dojo toolkit and Prototype and one of the things that those libraries do is that remoting layer, and we've already talked about the benefits there, but they also offer a lot more. So for example on the Dojo site it's a very mature, open source framework that gives you a whole set of packages, so if you're a Java guy you see these doc name space kind of looking packages. They give you the IO package which is to use for XHR Ajax request, gives you the graphics packages which allows you to do graphical effects, movements, and things like that, there's a whole widget API which allows you to build little reusable widgets and all you have to do then is actually use a HTML markup based language so this sounds more like XUL (pronounced 'zool') and XAML on the Microsoft side that allows you to just say div type equals or it's actually Dojo type equals editor and then Dojo automatically goes in and builds a very rich wysiwyg editor tool or kind of like a word based editor tool, so there's a whole notion of widgets.

There's also additions to the language itself, to JavaScript, so there's a Dojo.lang that gives you things like mix ins so if you're using languages like Ruby and the others like that, you'll like to mix in code from other objects and say "Hey, the code is in that object and that one, put them all together and allow me to have access to them right here. A lot of other language exceptions can go with it, one of the most important is actually the fact that JavaScript unfortunately doesn't have name spaces by default, so this means that you can get tons of collisions as you have different functions and things that are going on, anyone can rewrite those functions because JavaScript allows you to, anytime, add methods, take them away from an object or put them on to a type. So even if you have a thousand objects that are in the vm if I had the method foo to the type of var all of the objects instantaneously get that method added.

It's dangerous to not have these name spaces, so Dojo adds this name space routine so what you end up doing is that in different packages you say Dojo require the widget or whatever, Dojo require the XHR object. Whatever you need from within this large Dojo system you require and it only downloads the code you need on the fly right then so you don't have to download this massive library. Dojo has a whole bunch of these different kinds of name spaces, they cover everything. Another really cool one that you always end up using is the event package and what's cool about that is another one of the problems between IE and Firefox is the dom events are different in different areas.

Normally you have to write code so on Firefox it gets passed this event, on IE I have to get this event this way instead. And Dojo totally abstracts that away from you. And allows me to be able to say: Dojo connect to this dom element, to this node and if anything changes on that node run this function so I can do something dynamically. Even cooler than that you can do AOPsh stuff, you can say if this function ever gets code run this function as well so I can do stuff. So you can do JavaScript AOP and go really crazy. Then there's logging as well and things like that. Logging, what does that mean?

In JavaScript that means that instead of doing the alarm boxes to try and debug you have a little div in your application in debug mode and then as it goes through and different events happen you log out and they show up in that little div, so you can kind of capture what's going on. So that's you know just a few of the mirriad of name spaces that are out there for Dojo. A lot of people kind of think "ah, it's just a little Ajax thing", but it's a lot more and it's a lot of things you achieve wish you had in JavaScript. So then there's Prototype, and Prototype is a smaller framework and most people know it because it's coupled to Ruby on Rails, it's coupled from the stand point that Rails uses Prototype, it's not coupled from the standpoint that if you're writing Java you couldn't use Prototype. You can totally use it.

So Prototype has the same abstractions over XHR kind of things, it also has a bunch of effects, and it adds a lot of language things just like Dojo does in its module. So it actually looks very similar to Ruby in some things you can do so you can say: array dot each function and each element just like you do in Ruby. A lot of these things are kind of added, a lot of functions, it's all about making life easier for you. But then what everyone talks about is the $ function and so what that means is that JavaScript allows you to have a function literally named $, you couldn't do that in other languages and so you end up writing dollar sign open...the element id or actually even a node itself and it can only go and get a document element by id if it's a string that you past in and you can give multiple within that.

So it's kind of funny because it looks kind of Pearlish in some way because you got this 'dollar sign' function which makes shortcuts for everything. And then Prototype with these effects, there's another library called Scriptaculos that kind of add all these effects. The effects were put into Prototype first from this guy called Thomas Fuchs who kind of created Scriptaculos and the original prototype ones, and that's what you see all over the place with yellow fade techniques, things moving around, wobbling, and all these kind of crazy effects that are out there.

我对Dojo也没有什么偏向,也认为yui-ext的前景很好。不过建议各位最好将Dojo尽力在解决的问题先搞搞清楚,不要这么主观。日本文化又怎样?Ruby是日本人创造的,因为这个就完全拒绝Ruby吗?
0 请登录后投票
   发表时间:2007-03-10  
你们说的侵入性是什么?你们理解什么叫做Unobtrusive吗?Dojo与Unobtrusive有很大的冲突吗?
0 请登录后投票
   发表时间:2007-03-10  
侵入就是说在你的代码里面加入太多自身逻辑之外的东西。

比如说ejb侵入严重,而spring是无侵入的框架。

目前来说,脚本这块我还没看到那里有什么好的无侵入的管理框架。
这也是我开发jsi的一个原因(干掉Dojo也是一个原因^_^)
0 请登录后投票
   发表时间:2007-03-10  
to jindw:
你最好举一个例子来说明,好吗?

如果说对于DHTML开发,所谓的Unobtrusive是首先需要认真考虑的问题,其他的还在其次。
0 请登录后投票
   发表时间:2007-03-11  
dlee 老大,能否就你提及的概念做一些简洁的介绍,哪怕从哪拷贝一段也行啊,反正都提了出来了吗,我网上也找过,但还是怕理解不对啊,这样就没有讨论的前提了,结果我说了半天,可能结果先被批概念理解错误,这样总是不好的嘛
dojo的这大段英文在我看来,好象他要做w3c没做的标准一样的,通过dojoml和js以及dojo的解释引擎做一个通用的UI方案来一样,但是不管“目标如何高尚”做出来的东西都要好用啊,比如js这一块,我感觉现在ajax开发最头痛的就在这点了,这点都解决不好谈别的也就意义不大了,就好比“空想社会主义”拉。

ps:还有国内的各位js大拿有没有好的ajax的项目可以参考,或者好的ajax的开源项目,ajax中国这个网站我去过,个人感觉体验很差哦
0 请登录后投票
   发表时间:2007-03-11  
dengyin2000 写道
建议不要用dojo。 现在项目中用dojo搞死人了。用用dojo的event io之类的还是可以。 widget千万不要用。


说得很好啊,至少给别人是一种参考,当然也许在高人的眼里是“你们”实力不够拉,让很多人在使用之前先有点“自知之明”也是好的吧。
0 请登录后投票
   发表时间:2007-03-11  
dojo 中确实存在许多的bug。我们现在在做的一个RSS-READER项目,其实也就是用到了dojo的TreeV3 Dailog InlineEditor组件,和event io里面的东西。TreeV3我们改了许多。而且dojo自己也承认treeV3的DND现在还存在许多的问题。有时候老是会出现一些奇怪的问题。反正现在很不爽。
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics