CORBA on Mac OS X (Cocoa)

為{幸葍}努か 提交于 2019-12-22 14:54:53

问题


I am currently looking into different ways to support distributed model objects (that is, a computational model that runs on several different computers) in a project that initially focuses on Mac OS X (using Cocoa). As far as I know there is the possibility to use the class cluster around NSProxy. But there also seem to be implementations of CORBA around with Objective-C support.

At a later time there may be the need to also support/include Windows machines. In that case I would need to use something like Gnustep on the Windows side (which may be an option, if it works well) or come up with a combination of both technologies. Or write something manually (which is, of course, the least desirable option).

My questions are:

  1. If you have experience with both technologies (Cocoa native infrastructure vs. CORBA) can you point out some key features/issues of either approach? (EDIT: As I had already pointed out in this thread remote methods are unavailable for the iPhone and the iPad so far. On the other hand, there are CORBA implementations that work on either platform, e.g. "AdORB - CORBA ORB for Mac OS X and iPhone OS".)

  2. Is it possible to use Gnustep with Cocoa in the way explained above? [EDIT: According to the Gnustep FAQ entry 1.1.5 this is not possible, so using Cocoa's native infrastructure locks me into this technology.]

  3. Is it possible (and reasonably feasible, that is, simpler than writing a network layer manually) to communicate among all Mac OS clients using Cocoa's technology and with Windows clients through CORBA? [EDIT: From what I have learned now this is possible, but certainly not feasible. Messages would have to get forwarded both ways, i.e., one needs a "proxy" for forwarding messages from one system to the other and vice versa. This is essentially equivalent to writing a network layer manually with no practical benefit from either the NSProxy class cluster nor CORBA.]

UPDATE: CORBA seems to really be a better match when flexibility and extensibility is a concern. The downside is that it seems to be more complex to learn and also use initially, see this thread (link provided by Kristopher Johnson – thanks!) for different perspectives on the practical aspects. Webservices are a viable option as long as the communication pattern is simple enough, see this thread for options that work well on iOS. I have summarized my findings in this article.


回答1:


The easiest way to implement distributed objects in Cocoa is with, well, Distributed Objects (or on Mountain Lion, XPC). This really is a very straightforward way to get RMI (here's a full example of DO). However these protocols are proprietary and can't be used with non-Apple platforms; while GNUstep does use DO and I've used their implementation successfully on cross-platform projects, their protocol is not compatible with Apple's. So you'd either have to use GNUstep in its gnu-gnu-gnu library combo on Mac OS X instead of Cocoa (which is not something I'd recommend), or choose a different approach.

CORBA is one such "different approach". The main differences between CORBA and DO are:

  • in CORBA, you define the messaging interface using IDL which is used to generate ObjC. With DO, you use Objective-C directly.
  • CORBA doesn't support "duck typing"; it's strongly typed, so every method you intend to use remotely must be specified in the IDL. This also means that any method you do use is guaranteed to be implemented at the other end (of course the other end isn't guaranteed to be available in any RMI implementation).
  • most of CORBA's user base isn't on ObjC (Java and C++ are more common).
  • CORBA has wider platform support.
  • CORBA implementations don't need to be in ObjC.



回答2:


FWIW, I wouldn't use CORBA unless you have existing CORBA-based infrastructure you need to interface with.

CORBA was OK in its day, but it is a "dying" technology, and you are going to have a hard time getting the necessary support going forward. There is also a pretty steep learning curve.

I'd stay away from the Cocoa/Gnustep stuff too, if you want something cross-platform, as it really isn't very well supported anywhere other than OS X and iOS.

Rather than mastering these legacy technologies, I think your time would be better spent figuring out how to use Web Services, SOAP, or other mainstream cross-platform integration technologies.



来源:https://stackoverflow.com/questions/2848900/corba-on-mac-os-x-cocoa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!