共享库的iPhone和黑莓 [英] Shared Library for iPhone and BlackBerry

查看:152
本文介绍了共享库的iPhone和黑莓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组功能(类)的,我想与我建立了iPhone和黑莓(Java)的应用程序共享。有没有人有这样做的最佳做法?

I have a set of functionality (classes) that I would like to share with an application I'm building for the iPhone and for the Blackberry (Java). Does anyone have any best practices on doing this?

推荐答案

由于Grouchal提到的 - 你是不是要能够共享两个平台之间的应用程序的任何物理组件。然而,你应该能够分享您的应用程序的逻辑设计,如果你仔细它分成高度松散层。这仍然是一个巨大的胜利,因为逻辑应用程序设计大概占了你的开发工作的很大一部分。

As Grouchal mentioned - you are not going to be able to share any physical components of your application between the two platforms. However you should be able to share the logical design of your application if you carefully separate it into highly decoupled layers. This is still a big win because the logical application design probably accounts for a large part of your development effort.

您的目的可以换,你用自己的接口使用平台特定API的部分(iPhone的SDK等)。这样做你有效地隐藏特定于平台的库,使您的设计和code更容易在平台的差异打交道时管理。

You could aim to wrap the sections of the platform specific APIs (iPhone SDK etc.) that you use with your own interfaces. In doing so you are effectively hiding the platform specific libraries and making your design and code easier to manage when dealing with differences in the platforms.

有了这个地方,使其出现两种平台上的非常相似,你可以写你的核心应用程序code - 即使它们用不同语言编写。我发现的Java和Objective-C是非常相似的概念(至少在我使用它的水平),并期望能够与实现平价至少以下内容:

With this in place you can write your core application code so that it appears very similar on either platform - even though they are written in different languages. I find Java and Objective-C to be very similar conceptually (at least at the level at which I use it) and would expect to be able to achieve parity with at least the following:


  • 一个几乎相同的Java和Objective-C类具有相同的名称和职责

  • 的Java / Objective-C类有类似的命名方法

  • 的Java / Objective-C的方法具有相同的责任和逻辑的实现

这仅此便可使应用程序更容易跨平台的理解。当然,code总是会非常不同的边缘 - 也就是当你开始的观点,线程处理,网络等。但是,这些问题将由曾经开发应该有相当静态的接口API的封装处理。

This alone will make the application easier to understand across platforms. Of course the code will always look very different at the edges - i.e when you start dealing with the view, threading, networking etc. However, these concerns will be handled by your API wrappers which once developed should have fairly static interfaces.

您也可以从中受益,如果你需要交付给这两个平台,你可能会发现,您可以重用或扩展您的API包装后进一步开发应用程序。

You might also stand to benefit if you later developer further applications that need to be delivered to both platforms as you might find that you can reuse or extend your API wrappers.

这篇关于共享库的iPhone和黑莓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆