SproutCore 与卡布奇诺

发布于 2024-10-04 19:00:18 字数 201 浏览 6 评论 0原文

在您的体验中,除了 Javascript 与 Objective-J 的语言差异外,Cappuccino 相对于 SproutCore 还提供哪些优势,反之亦然?

从长期预测来看,SproutCore 是否比 Cappuccino 更受“支持”,因为它有苹果的支持?

我正在尝试在两者之间做出选择。我熟悉 JavaScript 和 Objective-C。

Aside from the language differences Javascript vs. Objective-J what benefits does Cappuccino provide over SproutCore and vice-versa in your experiences?

In terms of a long-term forecast, is SproutCore more "supported" than Cappuccino because it is backed by Apple?

I am trying to choose between the two. I am both familiar with JavaScript and Objective-C.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

深海里的那抹蓝 2024-10-11 19:00:18

这是一个有趣的问题,并且在各种消息组、Twitter 甚至 IRC 上经常出现。有几种方法可以评估 SproutCore 与 Cappuccino 的比较,但是,人们最直接看到的一些比较可能如下:

1) 它们各自的功能集
2) 易于使用
3) 社区支持和文档

让我们看看第一点——各自的功能集。对于“功能集”,有几种看待它的方法。从他们拥有的 UI 小部件的数量来看;将事物连接在一起并与某种后端通信的基础支持;框架的一般架构方法虽然不一定是“特性”,但仍然很重要;是的,甚至是您可以使用的语言。

关于语言,我认为重要的是不要忽略正在使用的内容(JS 与 Obj-J)。为什么?因为收养和你来自哪里。 SproutCore 的观点是 JavaScript 确实是网络语言,因此您可以使用它来针对框架进行编程。 JavaScript 缺乏语言面向对象的完整性(正确的对象-对象继承等),它在框架中进行了弥补(例如 MyApp.Foo = SC.Object.extend({...}))。卡布奇诺是从不同的角度出现的。他们使用 Obj-J 作为 JS 的主要语言增强,以便注入 JS 所缺少的语言功能;这不是将这些语言功能直接注入框架(Cappuccino)本身。当然,正如 Cappuccino 的人们之前指出的那样,您仍然可以使用 JS 来针对 Cappuccino 本身进行编程,但是,这样您就错过了 Obj-J 提供的功能。卡布奇诺社区请注意:如果我错了,请纠正我:-)。最后,如果您已经熟悉 Obj-C,那么 Obj-J 可能更适合您。嘿,甚至索尼现在显然也加入了整个 Obj-C 潮流,针对他们的移动平台进行开发:-P。

看看这两个框架的架构,他们都以苹果的 Cocoa 框架为指导/灵感。 Cappuccino 充分考虑了 Cocoa,并基本上移植了 Cocoas API。再说一遍,如果您以前使用 Cocoa 在 Apple 开发应用程序,那么您可能会感到宾至如归。另一方面,SproutCore 从 Cocoa 中获得了合适的灵感。至于纯架构,它们都遵循 MVC,都使用 Cocoa 风格的绑定,都有数据存储机制,并且都有各自的渲染和组合 UI 小部件/视图的风格。

对我来说,视图的呈现是一个特别重要的领域。这两个框架都有一定程度的抽象,以便让您免于直接处理 CSS 和 HTML,即使最终它们必须呈现为 Web 浏览器最终理解的内容。

在 Cappuccino 方面,它们完全抽象了 CSS 和 HTML。相反,您可以使用框架的各种渲染基元来“绘制”您的视图。由于这种抽象级别,Cappuccino 可以利用可用的最佳渲染方法,而不是在某种程度上与 CSS 和 HTML 耦合。

至于 SproutCore,可以说您的渲染更接近“金属”。在进行视图的纯渲染时,您会使用提供一定程度抽象的渲染上下文对象,但最终,您将直接注入 HTML 并添加类名来应用 CSS。即使在渲染视图之后并且您想要根据事件操作视图的某些部分,您也可以直接访问 DOM 元素并操作它们的属性。根据您来自哪里,这可能看起来是好是坏。适合那些习惯使用 CSS 和 HTML 并且喜欢更直接地控制视图的呈现和样式设置的人。如果您想一般性地渲染视图,以便根据浏览器允许的内容(HTML/CSS、SVG、HTML5 画布等)使用最佳渲染方法,那就不好了。但是,请注意,未来计划使 SproutCore 具有更抽象的渲染方法,但如果您愿意,仍然允许您直接使用 HTML 和 CSS。因此,您最终将获得两全其美的效果。

现在,至于两个框架附带的库存 UI 小部件/视图——它们都有很多开箱即用的功能,可以让您继续使用。按钮、标签、列表、分段视图、单选按钮、滚动条等——它们都在那里。因此,可以肯定地说您在两个阵营中都表现得很好。

回到过去,现在让我们讨论一下易用性。对我来说,易用性取决于您使用 JavaScript、HTML、Obj-C、Cocoa、其他 MVC 框架、文档和社区支持的个人经验。如果您从未使用过 Cocoa,或者从未构建过类似 Decktop 或 iPad 的应用程序,那么可以公平地说,无论您选择什么框架,您都会有一定的学习曲线。话虽如此,您不知道和想学习的内容可以通过每个框架各自的社区和文档来获取。两者都有活跃的社区,因此,如果您陷入困境,您也不会被冷落。至于文档,无可否认,卡布奇诺占据上风。 SproutCore 的文档缺乏,但代码库至少有完整的注释。 SproutCore 社区完全了解需要更新的文档,并且目前正在处理该问题,因此请继续检查。

最后,您提到了对两个框架的长期预测。众所周知,摩托罗拉购买了 Cappuccino 框架,因此肯定有一家大公司支持其发展和长寿,或者至少目前看来是这样。至于Apple和SproutCore,我个人无法代表他们说话,但Apple并不拥有该框架。有许多公司和个人都以某种方式使用该框架并为该框架做出贡献。由于该框架的开发更加有机,这可能会让一些人和公司对那些正在关注 SproutCore 的人产生犹豫或不适,但我不认为这是一个问题。我的感觉是,这两个框架都会存在很长一段时间,特别是现在越来越多的人正在考虑使用开源框架开发下一代桌面和 iPad 应用程序。而且,嘿,框架之间的竞争是好的——让每个人都保持警惕:-)。

希望这些信息可以帮助您做出决定!

干杯,

迈克

This is an interesting question, and one that has been popping up fairly frequently on various messages groups, twitter, and even IRC. There's a couple of ways to evaluate SproutCore versus Cappuccino, but, perhaps, some of the immediate caparisons that people look at are the following:

1) Their respective feature set
2) Ease of use
3) Community support and documentation

Let's look at the first point -- there respective feature set. By "feature set" there's a couple of ways to look at it. From the number of UI widgets they have; the foundational support to connect things together and communicate with some kind of back-end; the framework's general architectural approach, although not necessarily a "feature", but still important; and, yes, even the language you can use.

Regarding language, I think it's important that you do not dismiss what is being used (JS versus Obj-J). Why? Because of adoption and where you are coming from. SproutCore came from the perspective that JavaScript is indeed the language of the web, so it's what you use to program against the framework. Where JavaScript lacks in language OO completeness (proper object-object inheritance, etc) it makes up for in the framework (e.g. MyApp.Foo = SC.Object.extend({...})). Cappuccino comes in from a different angle. They use Obj-J as a primary language enhancement to JS in order to inject language features that JS is missing; this instead of injecting those language features directly into the framework (Cappuccino) itself. Of course, as the folks over at Cappuccino have noted before, you can still use JS to program against Cappuccino proper, but, then, you miss out on what Obj-J provides. Note to the Cappuccino community: Please correct me if I'm wrong :-). Finally, if you're someone who is already familiar with Obj-C then Obj-J may be more your cup of tea. Hey, even Sony is apparently now jumping on the whole Obj-C bandwagon to develop against their mobile platform :-P.

Looking at the architecture of the two frameworks, they both looked at Apple's Cocoa framework for guidance/inspiration in one form or another. Cappuccino took Cocoa fully to heart and basically ported Cocoas API. Again, if you're coming from developing apps in Apple using Cocoa then you're probably going to feel right at home. SproutCore on the other hand took inspiration from Cocoa where it felt right. As for pure architecture, they both follow MVC, they both make use of Cocoa-style bindings, they both have a data store mechanism, and they both have their own respective style of rendering and composing UI widgets/views.

The rendering of views is, to me, a particular area of importance. Both frameworks have some level abstraction in order to remove you from directly dealing with CSS and HTML even though at the end of the day they have to render to what the web browser ultimately understands.

On the Cappuccino side, they completely abstract away CSS and HTML from you. Instead, you use the framework's various rendering primitives to "draw" your views. Because of this level of abstraction, Cappuccino can make use of the best rendering approach available instead of coupling you, to some degree, with CSS and HTML.

As for SproutCore, you are rendering closer to the "metal" so to speak. When doing a pure rendering of a view, you make use of a rendering context object that provides a certain degree of abstraction, but, ultimately, you are directly injecting HTML and adding class names to apply CSS. Even after your view has been rendered and you want to manipulate certain parts of the view based on an event, you can directly access to the DOM elements and manipulate their properties. Depending on where you are coming from this may seem good or bad. Good for those who are used to working with CSS and HTML and like the more direct control over how the views are rendered and styled. Bad if you want to generically render a view in order to make use of the best render approach based on what the browser allows (HTML/CSS, SVG, HTML5 canvas, etc). But, note, there are future plans to make SproutCore have a more abstract rendering approach but still allow you to directly work with HTML and CSS if you so choose. So you'll eventually get the best of both worlds.

Now, as for the stock UI widgets/views the two frameworks come with -- they both have a lot right out of the box in order to get you going. Buttons, labels, lists, segmented views, radio buttons, scrollers, etc -- they're all there. Therefore, it's safe to say you're fine in both camps.

Going all the way back, let's now discuss the ease of use. To me, ease of use is based on you own personal experience working with JavaScript, HTML, Obj-C, Cocoa, other MVC frameworks, documentation, and community support. If you've never worked with Cocoa, or never built a decktop- or iPad-like app, then it's fair to say you're going to have a bit of a learning curve no matter what framework you choose. That being said, what you don't know and want to learn can be acquired through each framework's respective community and docs. Both have active communities in one for or another, so you won't be left out in the cold if you get stuck somewhere. As for docs, Cappuccino, admittedly, has the upper hand. The docs for SproutCore are lacking, but the code base is at least fully commented. The SproutCore community is fully aware of the docs needing to be updated, and it is currently something that is being dealt with, so keep checking.

Finally, you mentioned the long-term forecast for the two frameworks. It's public knowledge that Motorola bought the Cappuccino framework, so you certainly have a big company backing its growth and longevity, or at least it seems like that way for now. As for Apple and SproutCore, I personally can't speak for them, but Apple does not own the framework. There are many companies and various individuals that all use and contribute back to the framework in some way. That might give some people and companies pause or discomfort for those who are looking at SproutCore due to the more organic nature of the framework's development, but I don't see that as a problem. My feeling is that both frameworks will be around for a long time, especially now that more are looking at developing next generation desktop and iPad apps using open source frameworks. And, hey, competition between the frameworks is good -- keeps everyone on their respective toes :-).

Hope this information helps you out with your decision!

Cheers,

Mike

请帮我爱他 2024-10-11 19:00:18

我想谈谈对 Objective-j Michael 的评论。

如果您使用 JavaScript 而不是 Objective-j,您不会失去任何东西。实际上,这种区别有点难以做出,特别是在我们有免费桥接课程的情况下(稍后会详细介绍)。

Objective-j 实际上只是 js 的一个薄包装。它提供了传统上作为语言功能实现的经典继承,sproutcore 将其实现为框架功能,它还提供代码导入、访问器生成、静态作用域和对消息 nil 的支持。

如果你愿意的话,Objective-j 实例变量可以通过传统的点语法访问......我喜欢这样想:一旦你开始编写一个方法,你主要是在编写 JavaScript。也就是说,循环、变量、函数、闭包等都只是 javascript。你不会因为掉下来而失去任何东西,这正是语言的设计方式。

我们更进一步,通过“免费桥接”我们的一些类 CPDate、CPArray、CPException、CPString 以及可能还有更多我不记得的类。免费桥接仅意味着 CPArray 是本机 js 数组,而本机 js 数组是 CPArray,因此您可以互换使用这两个世界的方法和函数。

例如可以这样做:

var foo = [];
[foo addObject:"bar"];
foo.push("2nd push");
var value = foo[0];
var value2 = [foo objectAtIndex:0];

alert(value === value2); //true

正如你所看到的,我一起使用 Objective-j 语法和 js 语法......你可以想象这个的威力。

我想提出的最后一件事是为了确保不会造成混淆:objective-j 在浏览器中被解析。它不需要预先编译(尽管我们在您准备好部署应用程序时提供了编译工具)。

我认为有些人不必要地对 Objective-j 感到厌烦,就好像它是某种需要时间学习的猛兽一样,虽然 Objective-j 为 js 添加了很多很棒的功能,但真正学习它们并不需要你真正花时间去学习。如果您已经熟悉面向对象编程,那么一天中的大部分时间都会更好,而且显然如果您来自可可,您将能够直接跳入其中。

I'd like to touch on the comments made about objective-j Michael.

You're not going to lose anything if you drop down to JavaScript instead of objective-j. In all actuality the distinction is kind of difficult to make, especially in cases where we have toll-free bridged classes (more on that in a bit).

Objective-j is really just a thin wrapper over js. It provides classical inheritance something that has traditionally been implemented as a language feature, which sproutcore implements as a framework feature, it also provides code importing, accessor generation, static scoping, and support for messaging nil.

Objective-j instance variables are accessible via the traditional dot syntax if you want... I like to think of it like this: once you start writing a method, you're mostly writing JavaScript. That is, loops, variables, functions, closures, etc are all just javascript. You're not losing anything by dropping down, that's exactly how the language is designed.

We take it a step further by "toll-free bridging" some of our classes CPDate, CPArray, CPException, CPString and perhaps more that I can't recall. Toll free bridging just means a CPArray IS a native js array, and a native js array is a CPArray, so you can use methods and functions of both world interchangeably.

So for example would could do:

var foo = [];
[foo addObject:"bar"];
foo.push("2nd push");
var value = foo[0];
var value2 = [foo objectAtIndex:0];

alert(value === value2); //true

As you can see I'm using objective-j syntax and js syntax together... You can imagine the power if this.

The final thing I want to put out ther, just to make sure there is no confusion: objective-j gets parsed in the browser. It doesn't need to be compiled before hand (although we provide compilation tools for when you're ready to deploy your app).

I think some people are needlessly put off by objective-j as if it's some monstrous beast that will take time to learn, and while objective-j adds a lot of great features to js, to actually learn them won't really take you the better part of a day if you're already familiar with object oriented programming, and obviously if you're coming from cocoa you'll be able to jump right in.

我家小可爱 2024-10-11 19:00:18

来自 Cappuccino 网站:

“现有框架的另一端是 SproutCore 等技术。虽然 SproutCore 的目标与 Cappuccino 类似,但它采用了截然不同的方法。它仍然依赖于 HTML、CSS、JavaScript、Prototype 和全新且独特的 API 集。它还需要特殊的开发软件和繁琐的编译步骤。

使用 Cappuccino,您无需了解 HTML。您不需要与 DOM 进行交互。我们只要求开发人员学习一种技术,Objective-J 和一组 API,而且这些技术是众所周知且易于理解的现有技术的实现。开发人员可以利用数十年的集体技术。的经验,真正加快构建丰富的 Web 应用程序的步伐。”

因此,Cappuccino 似乎没有/不需要任何构建工具,并且完全将浏览器从开发人员手中抽象出来。而在 Sproutcore 中,您可以获得构建工具(例如开发服务器),并且开发人员应该对 DOM 有所了解。

From the Cappuccino website:

"On the other end of the existing frameworks are technologies like SproutCore. While SproutCore set out with similar goals to Cappuccino, it takes a distincly different approach. It still relies on HTML, CSS, JavaScript, Prototype, and an entirely new and unique set of APIs. It also requires special development software and a cumbersome compilation step. We think this is the wrong approach.

With Cappuccino, you don't need to know HTML. You'll never write a line of CSS. You don't ever have interact with DOM. We only ask developers to learn one technology, Objective-J, and one set of APIs. Plus, these technologies are implementations of well known and well understood existing ones. Developers can leverage decades of collective experience to really accelerate the pace of building rich web applications."

So it seems that Cappuccino does not have/need any build tools, and completely abstracts the browser away from the developer. Whereas in Sproutcore you get build tools (a development server, for example) and the developer should be somewhat aware of what DOM is.

调妓 2024-10-11 19:00:18

迈克尔·科恩斯的回答几乎涵盖了所有内容,因为它非常详细。

在过去的三周里,我一直在为做出决定而苦苦挣扎。我已经阅读了网上关于这两个框架的所有内容,并且我已经用这两个框架编写了很多源示例,但仍然无法做出决定。以下问题让我从一个框架跳到另一个框架,并让我的决定变得更加艰难。

  1. Sproutcore 拥有比卡布奇诺更好的数据存储 API。

  2. Sproutcore 比目前的卡布奇诺更好地利用了绑定。 Cappuccino 也有 kvc/kvo 支持,但绑定尚未完全实现。例如,在 sproutcore 中,您可以非常轻松地使用绑定和 ArrayController 实现增量加载,而另一方面,在 cappuccino 中则不那么简单。当然,cappuccino 提供了 CPTableView DataStore api,它非常干净,并且可以实现类似的结果,只是不使用绑定。这就是可可在核心数据之前所做的事情。不过,卡布奇诺中的绑定一直在不断改进。

  3. 根据我个人的口味,Cappuccino 有更好的 view api。虽然我习惯于开发 html 和 DOM,但我更喜欢完全抽象 DOM 并摆脱 css 的想法。

  4. 对我来说真正重要的一个问题是 sproutcore 中缺乏良好的 TableView。目前 SC.TableView 处于 alpha 阶段,它根本没有性能。我不知道 sproutcore 中表格视图的时间线。我尝试在 irc sproutcore 频道上询问,但没有得到满意的答案。另一方面,Cappuccino 有一个很棒且非常优化的表格视图。

  5. 我发现在 cappuccino 上编写的实际应用程序比在 sproutcore 上编写的应用程序更多。卡布奇诺还有一个非常漂亮的完整应用程序作为源示例提供,非常有帮助。查看 http://githubissues.heroku.com/

尽管我没有 Objective-C 的经验,而且我更喜欢纯 js 语法,但我可能会在当前的项目中使用 cappuccino,并希望 sproutcore 将来能推出更好的表格视图。

Michael Cohens answer pretty much covered everything since it was extremely detailed.

I have been struggling with a decision for the past 3 weeks. I have read everything there is out on the web about both frameworks and I have written a lot of source samples with both and still cannot make a decision. The following issues have me jumping from one framework to the other and keep making my decision tougher.

  1. Sproutcore has a better data store api than the one cappuccino has.

  2. Sproutcore makes use of bindings better than cappuccino currently does. Cappuccino does also have kvc/kvo support but bindings are not totally there yet. For example in sproutcore you can implement incremental loading with bindings and ArrayController very easily where on the other hand in cappuccino its not as straightforward. Of course cappuccino offers the CPTableView DataStore api which is pretty clean and can achieve similar results just not with bindings. Its what cocoa did before core data. Bindings are constantly being worked on in cappuccino though.

  3. Cappuccino has a better view api according to my personal taste. Although I am used to developing html and the DOM I much prefer the idea of abstracting the DOM completely away and getting rid of css.

  4. One issue that is really important to me is the lack of a good TableView in sproutcore. Currently SC.TableView is in alpha and it is not performant at all. I dont know of a timeline for the tableview in sproutcore. I tried asking on the irc sproutcore channel but got no satisfying answer. Cappuccino on the other hand has a great and very optimized table view.

  5. I have found more real world applications written on cappuccino than on sproutcore. There is also a pretty nice full blown application that is provided by cappuccino as a source sample and is very helpful. Check out http://githubissues.heroku.com/.

Despite the fact that I have no experience in objective-c and I much prefer the pure js syntax I will probably go with cappuccino on my current project and hope sproutcore comes out with a better table view in the future.

荒人说梦 2024-10-11 19:00:18

我写了一篇关于“卡布奇诺与 sproutcore”的博客文章。这不是技术比较,而是比较其他有趣的数据。

http://elii.info/2010/11/cappuccino-vs-sproutcore/

I wrote a blog article exactly about "cappuccino vs. sproutcore". It is not a technical comparison but compares other interesting data.

http://elii.info/2010/11/cappuccino-vs-sproutcore/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文