哪个 JavaScript 框架可以开发客户端复杂的 UI?道场、SproutCore、卡布奇诺
我使用 Dojo 和 Dijit 来开发基于浏览器的 IDE 已有一年多了。 Dojo 是一个很棒的框架。但是使用 Dojo 创建类似 IDE 的界面非常麻烦并且浪费大量时间,除非您是 CSS 超人。我对 HTML5、JavaScript 和 CSS 有很好的了解。构建我需要的 UI 需要进行一些 CSS 修改,这是我通过反复试验发现的。从 UI 设计到实现没有系统的方法,我担心更改 UI 布局,因为任何简单的更改都可能破坏 UI,主要是通过在我不需要的 Dijit 窗格中添加不相关的滚动条。 (复杂的 UI 有 4-5 层嵌套窗格,主要包括边框容器和内容窗格)
最近我遇到了 SproutCore 和 Cappuccino,它们有很棒的演示,而且它们的外观和感觉更基于桌面。已经有多次讨论将这两者进行比较。但他们都没有谈到从UI设计到实现有多系统、多快速?理想情况下,我应该能够在不超过几天的时间内实现我想要的 UI(假设我了解框架),并且将来更改它们应该很容易。
Dojo 的另一个困难是我必须直接使用 DOM 来添加和删除 dijit 小部件。虽然我确实希望保持这种灵活性,但我希望可以使用更高级别的抽象来定义应用程序 UI。我读过 SproutCore 和 Cappuccino 中的 MVC,但我想知道在实践中提供的抽象层是否加速了 UI 开发?或者提供的层是一个奇特的架构,只会增加代码的可读性?如果我使用这些抽象构建 UI,我会失去对 DOM 的直接访问吗?
干杯, 纳维德
I have been using Dojo and Dijit for more than a year to develop a browser-based IDE. Dojo is a great framework. But creating an IDE-like interface using Dojo is cumbersome and wastes a lot of time unless you are a CSS superman. I have a good understanding of HTML5, JavaScript, and CSS. Building the UI I needed required several CSS hacking that I found by trial and error. There was no systematic way to get from the UI design to the implementation and I am afraid to change the UI layout because any simple change can break the UI, mostly by adding irrelevant scroll-bars to Dijit panes where I do not need them. (the complex UI has 4-5 levels of nested panes including mostly border containers and content panes)
Recently I have come across SproutCore and Cappuccino, which have great demoes and their look and feel is more desktop-based. There has been several discussions comparing these two with each other. But none of them talk about how systematic and quick is it to get from UI design to implementation? Ideally, I should be able to implement the UI I want not more than a couple of days (Assuming that I know the framework), and changing them in the future should be easy.
The other difficulty with Dojo is that I have to work directly with DOM, to append and remove dijit widgets. While I do like to keep this flexibility, I wish I could use a higher level of abstraction to define the application UI. I have read about MVC in SproutCore and Cappuccino, but I am wondering if in practice the provided abstraction layer speeds up the UI development? or the provided layer is a fancy architecture that only increases the readability of the code? Will I lose the direct access to DOM if I build my UI using these abstractions?
Cheers,
Navid
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
卡布奇诺的水平要高得多。您使用 Objective-J 编写,而不是 HTML/CSS/JavaScript。我个人并不推荐它,因为 Objective-J 是一种小众语言,你会陷入一些未被所有人广泛理解的东西。您会发现寻找问题的答案更加困难,而其他人维护您的代码也会更加困难。
然而,由于它是高水平的,它确实可以让您免于“标准”(即 HTML/CSS/JavaScript)编程的苦差事。因此,您应该能够更快、更轻松地开发 UI,但您必须学习 Objective-J 的详细信息。总而言之,我认为在这里没有什么收获。
另一方面,SproutCore 是基于 HTML/CSS/JavaScript 的,因此您实际上不必重新学习基础知识。它遵循分离 UI 和数据关注点的 MVC 模型,因此 UI 编程应该更容易。
我个人的建议是坚持使用 Dojo —— 1.6 已经发布,它具有变更跟踪、状态跟踪和绑定支持。 1.7 即将到来。 MVC 模块正在快速改进。下一个版本,2.0,将会非常棒。它正在积极开发中,因此您不会落后。
Dojo 还可以与闭包编译器的高级模式一起使用,以生成高度紧凑、高度优化、完全混淆的部署构建。其他基于 JavaScript 的框架适应性较差。
Cappuccino is much higher-level. You write in Objective-J, not HTML/CSS/JavaScript. I personally do not recommend it as Objective-J is a niche language and you'd be stuck with something not widely-understood by everybody. You'll find it more difficult to look for answers to problems, and other people will have more difficulty in maintaining your code.
However, due to it being high level, it does shield you from the drudgery of programming in "standards" (i.e. HTML/CSS/JavaScript). Therefore, you should be able to develop UI's faster and easier, but you'll have to instead learn the ins-and-outs of Objective-J. All-in-all, not much to gain here, I suppose.
SproutCore, on the other hand, is HTML/CSS/JavaScript based, so you don't really have to relearn the basics. It follows the MVC model of separating UI and data concerns, so programming UI's should be easier.
My personal recommendation is to stick with Dojo -- 1.6 has come out, which has change-tracking, state-tracking and bining support. 1.7 is around the corner. The MVC module is improving fast. The next version, 2.0, will be quite awesome. It is being actively developed on, and so you won't be left behind.
Dojo can also be used with the Closure Compiler's Advanced Mode to make highly-compact, highly-optimized, fully-obfuscated builds for deployment. Other JavaScript-based frameworks are not as adaptable.
卡布奇诺绝对不仅仅只是提高可读性。如果您不希望卡布奇诺中的某些内容有滚动条,请不要给它一个。故事到此就差不多结束了,这也是使用这种框架的巨大优势之一。根据我的经验,HTML 和 CSS 只是无休止的故障排除过程。有了卡布奇诺,事情就会发生在你指定的地方并停留在那里。跨浏览器也是如此(大多数时候)。
此外,如果您选择,您可以使用 Interface Builder 和 Cappuccino 的 nib2cib 实用程序构建用户界面。这使得最初布局和随后随机调整按钮和控件都变得微不足道。
Cappuccino most definitely goes beyond just improving readability. If you don't want something to have a scrollbar in Cappuccino, don't give it one. That's pretty much the end of the story and one of the great advantages of using such a framework. In my experience, HTML and CSS is just an endless troubleshooting session. With Cappuccino things go where you say they should and stay there. And this is true across browsers as well (most of the time).
Furthermore you can, if you choose to, build your user interface using Interface Builder and Cappuccino's
nib2cib
utility. This makes it trivial both to initially lay out and to then later shuffle buttons and controls around.您考虑过 jQuery 和 jQuery UI 吗?
Have you considered jQuery and the jQuery UI?