开发者

Mobile cross-platform classes

开发者 https://www.devze.com 2023-01-12 23:02 出处:网络
Does the fact that different mobile platforms can use similar languages implies that you can reuse classes between these platform ? For example c++ code on iOS, Android and Symbian devices. Or is ther

Does the fact that different mobile platforms can use similar languages implies that you can reuse classes between these platform ? For example c++ code on iOS, Android and Symbian devices. Or is there some other things to take into account, libraries, etc. ?

In the same s开发者_如何学Cpirit would it be possible to share C# code between iOS, Android and Windows Phone using MonoTouch and MonoDroid(eventually) ?

Edit: Would it be possible to share the UI code between MonoTouch, MonoDroid ?


No, the languages are definitely too different. To be able to reuse classes they would have to be written in the same language. And since Apple have been kicking out every language except Objective-C from iOS, you won't be able to reuse code. The state of MonoTouch after Apple's (outrageous [subjective]) decision [1] is now very much in doubt.

However, in typical dictatorship fashion [subjective again], Apple have not been completely consistent, so they have not prohibited the use of technologies like PhoneGap ( http://phonegap.com ) or Titanium ( http://www.appcelerator.com/ ). There you write your application in HTML5, Javascript & friends. If you can live with writing apps using these techniques, a cross-platform approach with only one codebase is still possible.

And of course, remember that algorithms are not language specific. Classes in different langages can often be made almost identical in function, although you'll have the disadvantage of having to maintain several of them.

Edit:

Clarifications from discussion:

  • There is actually support for using C++ classes [2]. That opens up possibilities of code sharing of more abstract parts of an application.
  • The state of MonoDroid seems to very much unclear. The discussion referred to in [1] is long and have several strong answers pointing in both directions. It's important to remember that Apple's de facto target in their new licencing clauses are Flash, not cross-platform frameworks in themselves, no matter what Steve Jobs says [3]. That leaves open the possibility that Apple may want to silently allow apps based on MonoDroid or other cross-platform frameworks.

[1] As usual, this is not 100% clear, for example see this question: Is MonoTouch now banned on the iPhone?

[2] http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocCPlusPlus.html#//apple_ref/doc/uid/TP30001163-CH10-SW1

[3] http://www.apple.com/hotnews/thoughts-on-flash/?aosid=p204&siteid=1503186&program_id=2554&cid=OAS-EMEA-AFF&tduid=fb90c7ac85c9a334decb42b892cda59b

0

精彩评论

暂无评论...
验证码 换一张
取 消