Mac 开发的 PyObjc 与 RubyCocoa:哪个更成熟?

发布于 2024-07-11 16:09:09 字数 425 浏览 8 评论 0原文

我一直想尝试一下 Ruby 或 Python,同时我也一直想做一些 Cocoa 编程。

因此,我认为实现这两个目标的最佳方法是使用 Ruby 或 Python 到 Objective-C 的桥梁(PyObjc 或 RubyCocoa)来开发一些东西。

我知道,理想情况下,为了获得最佳的学习体验,我会独立学习每种技术,但我没有时间。 :)

所以我的问题是 PyObc 或 RubyCocoa 哪个是更成熟的平台,我正在寻找的主要内容:

  1. API
  2. 教程
  3. 文档工具
  4. 支持社区
  5. 通过桥梁提供 Cocoa API 的完整性

关于第 5 点,我不希望整个Cocoa API 将通过任一桥提供,但我需要有足够的 Cocoa API 来开发功能正常的应用程序。

I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming.

So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa).

I know that ideally to get the best learning experience I would learn each techonology independently but I don't have the time. :)

So my question is which is a more mature platform, PyObc or RubyCocoa, main things I am looking for:

  1. Documentation of API
  2. Tutorials
  3. Tools
  4. Supportive Community
  5. Completness of Cocoa API avaialble through the bridge

Regarding point 5 I don't expect that the entire Cocoa API will be availble through either bridge but I need to have enough Cocoa APIs available to develop a functioning application.

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

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

发布评论

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

评论(5

宛菡 2024-07-18 16:09:09

虽然你说你“没有时间”独立学习技术,但学习 Cocoa 的最快途径仍然是用它的母语来学习:Objective-C。 一旦您了解了 Objective-C 并克服了 Cocoa 框架的初始学习曲线,您将可以更轻松地选择 PyObjC 或 RubyCocoa。

While you say you "don't have time" to learn technologies independently the fastest route to learning Cocoa will still be to learn it in its native language: Objective-C. Once you understand Objective-C and have gotten over the initial learning curve of the Cocoa frameworks you'll have a much easier time picking up either PyObjC or RubyCocoa.

梦魇绽荼蘼 2024-07-18 16:09:09

我会赞同 Chris 的评估,并会详细阐述为什么你应该学习 Objective-C 来学习 Cocoa。 正如 Chris 所说,Objective-C 是 Cocoa 的基础和母语,它的许多范式都与这一血统有着千丝万缕的联系。 特别是,选择器和动态消息解析以及在运行时修改类的能力是实现 Cocoa 技术(例如分布式对象和绑定)所必需的。 尽管这些功能在其他动态语言(例如 Ruby 和 Python)中也可用,但语言模型中存在足够的不匹配,因此您至少必须了解 Objective-C 才能了解 Cocoa。 我建议您查看上一个问题以进行进一步讨论:我必须学习 Objective-C 才能进行专业的 Mac 开发吗?

幸运的是,Objective-C 非常容易学习。 我经常告诉人们,从 C/C++/Java 或 LISP、Scheme 或任何“较新”的动态语言(如 Ruby 和 Python)学习 Objective-C 需要一天的时间。 除了稍微扩展您的思维之外,您还将学会至少阅读几乎所有 Cocoa 文档和示例中使用的代码。

至于 Ruby 与 Python,桥接功能非常相似。 事实上,它们都使用 Apple 的 BridgeSupport (随 Leopard 一起提供)来提供桥接描述。 两者均受 Apple 支持并随 Leopard 一起提供。 您喜欢哪种语言取决于个人品味。 如果您选择 Ruby,我建议您看一下 MacRuby。 这绝对是 OS X 上 Ruby 的未来,因为它在 Objective-C 运行时之上重新实现了 Ruby 运行时。 这提供了一些不错的性能和概念优势(包括与 Objective-C 垃圾收集系统的集成,这是使用本机 python gc 的 PyObjC 目前缺乏的功能)。 MacRuby 还包括一个自定义解析器,使桥接 Objective-C 方法的语法变得更好一些。 MacRuby 的缺点是,在撰写本文时(2009 年 6 月),它还没有完全准备好用于生产级别。 因为听起来这对您来说是一个学习项目,所以这可能不是问题。

I would echo Chris' assesment and will expand a bit on why you should learn Objective-C to learn Cocoa. As Chris says, Objective-C is the foundation and native language of Cocoa and many of its paradigms are inextricably linked with that lineage. In particular, selectors and dynamic message resolution and ability to modify classes at run time are required to implement Cocoa technologies such as Distributed Objects and bindings. Although these features are available in other dynamic languages such as Ruby and Python, there is enough of a mismatch in the language models that you will have to at least understand Objective-C to understand Cocoa. I suggest you take a look at this previous question for further discussion: Do I have to learn Objective-C for professional Mac Development?

Fortunately, Objective-C is very easy to learn. I often tell people it will take them a day to learn Objective-C coming from C/C++/Java or LISP, Scheme, or any of the 'newer' dynamic languages such as Ruby and Python. In addition to expanding your mind a bit, you'll learn to at least read the code that is used in virtually all of the Cocoa documentation and examples.

As for Ruby vs. Python, the bridge capabilities are very similar. In fact, they both use Apple's BridgeSupport (shipped with Leopard) to provide the bridge description. Both are supported by Apple and ship with Leopard. It's a matter of personal taste which language you prefer. If you choose Ruby, I suggest you give MacRuby a look. It's definitely the future of Ruby on OS X, as it reimplements the Ruby runtime on top of the Objective-C run time. This provides some nice performance and conceptual advantages (including integration with the Objective-C garbage collection system, a feature currently lacking in PyObjC which uses the native python gc). MacRuby also includes a custom parser that makes the syntax of bridged objective-c methods a little nicer. The downside of MacRuby is that it's not quite ready for production-level use at the time of this writing (June 2009). Since it sounds like this is a learning project for you, that's probably not an issue.

枕头说它不想醒 2024-07-18 16:09:09

我想说,两者大致相等。 有些地方更好,有些地方更糟。 但我不建议使用其中任何一个来学习 Cocoa。 正如 Chris 所说,Cocoa 需要对 Objective-C 有一定的了解。 与 Objective-C 相比,我更喜欢 Ruby,但我仍然不建议用它来学习 Cocoa。 一旦您在 Cocoa/Objective-C 方面有了坚实的基础(没有双关语),那么这些桥梁就会对您有用。

Both are roughly equal, I'd say. Better in some places, worse in others. But I wouldn't recommend learning Cocoa with either. Like Chris said, Cocoa requires some understanding of Objective-C. I like Ruby better than Objective-C, but I still don't recommend using it to learn Cocoa. Once you have a solid foundation (no pun intended) in Cocoa/Objective-C, then the bridges can be useful to you.

诠释孤独 2024-07-18 16:09:09

Apple 似乎支持 Cocoa 的 Ruby 脚本,但不支持 RubyCocoa。 他们正在托管并且我相信支持 MacRuby。 我经常想知道 MacRuby 是否是 Apple 对 OSX 原型设计和全面应用程序开发的高级语言的回应。

Apple seems to be getting behind Ruby scripting for Cocoa but not RubyCocoa. They are hosting and I believe supporting MacRuby. I often wonder if MacRuby is Apple's answer to a higher level language for OSX prototyping and full on application development.

叫思念不要吵 2024-07-18 16:09:09

ObjectiveC 远没有 Python 或 Ruby 那样有趣或高效。 这就是为什么人们想要选择具有良好 Objective C 访问能力的 python 或 ruby​​。 在我看来,建议他们首先学习 Objective C 没有抓住重点。 关于 pyobjc 我有很多好话要说。 它与 Objective C 框架轻松互操作的能力非常出色。 我对 Ruby Cocoa 的经验较少,部分原因是当我上次查看时,它似乎没有那么干净且相对轻松的互操作性。 我对 MacRuby 感到犹豫,因为它似乎太过分了。 在 pyobjc 中,您可以编写普通的 python,并且仅在您真正想要/打算时子类化/使用 Foundation 和 Cocoa 对象。 根据我对 MacRuby 的理解,它是 Cocoa 之上的 Ruby。 所以字符串始终是 NSString。 我对此不太满意。 YMMV。

ObjectiveC is nowhere near as much fun or as productive as either Python or Ruby. That is why people want to pick a python or ruby with good Objective C access. Advising them to learn Objective C first misses the point imo. I have really good things to say about pyobjc. Its ability to interoperate painlessly with Objective C frameworks is superb. I have less experience with Ruby Cocoa and that was partly because when I last looked it didn't seem to have as clean and relatively painless interoperability. I feel hesitant about MacRuby because it seems to go too far. In pyobjc you can write plain python and only subclass/use Foundation and Cocoa objects when you really want/mean to. From what I understand of MacRuby it is a Ruby on top of Cocoa. So a string is always an NSString. I am less happy with that. YMMV.

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