使用一种编程语言 (C#) 针对多个移动平台进行定位/开发?成本效益? [英] Targeting/Developing for multiple mobile platforms with one programming language (C#)? Cost-Benefit?

查看:21
本文介绍了使用一种编程语言 (C#) 针对多个移动平台进行定位/开发?成本效益?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天可以在多个移动平台上使用 C# 编程,例如:

Today it is possible to use C# programming for multiple mobile platforms such as:

(如果我错过了一些,请随意编辑)当然,UI仍然是编程的工作,但可以共享应用程序的主要库.

(feel free to edit if I missed some) Of course, it is still programming effort for UI, but main libraries of app can be shared.

我们都要感谢围绕 Mono 项目和超级英雄 Miguel de Icaza 他的努力是无价的.

We can all thank to a team gathered around Mono project and superhero Miguel de Icaza whose effort is priceless.

让我烦恼的是,这些选项有什么好处?在多个移动平台上维护一个应用程序的成本是否会减少障碍,然后必须单独编码每个库以获得更好的性能.每种语言的学习曲线?成为万事通 vs .NET Ninja

What bothers me is, what are the benefits of these options? Is it cost of maintaining one app across multiple mobile platforms less impediment then having to code each library separately for better performance. Learning curve of each language? Being Jack of All trades vs .NET Ninja

或者知道在本机环境中编写的应用程序二进制文件的大小更小,甚至可能优化得更好,不要忘记您必须等待新平台操作系统更新的支持.

Or knowing that binaries of app programmed in native environment are less in size, maybe even optimized better and not to forget that you have to wait support of new platform os updates.

更新:显然还有一件事需要考虑,那就是支持.由于Novell 被Attachmate Group 收购,所有Mono 团队都被裁员.然而,由 Miguel De Icaza 领导的团队核心成员创立了新公司 Xamarin 将从头开始重塑 Mono Mobile 开发工具.

UPDATE: Obviously there is one more thing to consider and that is support. Since Novell is bought by Attachmate Group, all Mono team is laid off. However the core member of the team lead by Miguel De Icaza founded new company Xamarin which will reinvent Mono Mobile development tools from the scratch.

推荐答案

在我看来,使用单一环境(即 C#/.NET)的最大优点是代码可移植性.还有像 LINQ 这样很酷的东西,一旦你习惯了它,你就离不开它.但是,少数移动操作系统(iOS、Android、WP7)在 UI 方面大不相同.

In my opinion, the big pro of using one single environment (i.e. C#/.NET) is code portability. And cool things like LINQ that, once you get used to it, you can't live without. However, the few mobile OS's (iOS, Android, WP7) are quite different with regards to UI.

而且,如果我对您的应用程序没有误解,如果它要在移动设备上运行,它会获得相当多的 UI 交互.大多数移动应用就像 80% 的 UI 代码.

And, if I am not mistaken about your application, it's got a fair share of UI interactions if it is to run on a mobile device. Most mobile apps are like 80% UI code.

因此,无论如何,您最终都会为每个平台编写一组单独的 UI 代码——例如,您将使用 Silverlight WP7(以及所有 WPF 优点)编写,您将编写一个完全不同的Cocoa 中的一组 iOS 代码(IB、视图、控制器等),您将为 Android 编写一组完全不同的代码.

Therefore, you'll end up writing a separate set of UI code for each platform anyway -- for example, you'll be writing in Silverlight WP7 (and all the WPF goodness), you'll be writing a completely different set of code for iOS in Cocoa (IB, Views, controllers and stuff), you'll be writing yet a completely different set of code for Android.

我的经验一直是在任何平台上编写好的 UI 代码都需要大量的经验——例如学习 WPF/SL 已经是一场噩梦,那就是把 Cocoa Touch 和整个 Android 一团糟.当然,您可以编写三组外观和感觉相当相似的 UI,但很有可能您会非常努力地重用代码并拥有通用数据结构,以至于与专用应用程序相比,您的 UI 最终会低于标准 -- 在当今这个竞争激烈的移动应用世界中,非超级(更不用说低于标准)的 UI 体验意味着您的应用的死亡.

My experience has always been that it take a lot of experience to write good UI code on any platform -- e.g. learning WPF/SL is already the nightmare that is, throw in Cocoa Touch and the whole Android mess. Of course you can write three sets of UI that look and feel reasonably similar, but chances are that you'll be trying so hard to reuse code and have common data structures that your UI's will end up sub-par when compared to dedicated apps -- and in this cut-throat world of mobile apps today, a non-super (not to mention sub-par) UI experience means death to your app.

此外,所有三种移动环境都有不同的连接范式和多媒体范式.您最终编写了三个版本,学习了三种环境,尽管使用的是您熟悉的一种语言.

Also, all three mobile environments have different connectivity paradigms, as well as multimedia paradigms. You end up writing three versions, and learning three environments, albeit writing in one language you're familiar with.

您要重用的最多的是后端模块.决策引擎、搜索例程、数据管理等. 即使这些也会有问题,因为您将不得不在数据结构中做出妥协,以便轻松地与在三种不同 UI 范式上工作的三组不同 UI 代码进行集成.例如,您是否使用 DependencyObjects 来绑定到 MVVM 模型中的 Silverlight 视图?如果这样做,它将无法与 Cocoa 的 MVC 模型一起使用,并且您必须单独对这些绑定进行编码.

The most you're going to reuse is back-end modules. Decision engines, search routines, data-management etc. And even these are going to be problematic because you'll be force to have compromises in your data structures just to enable easy integration with three different sets of UI code working on three different UI paradigms. For example, do you use DependencyObjects for use to bind to Silverlight views in an MVVM model? If you do, it won't work with Cocoa's MVC model, and you have to code those bindings separately.

而且由于并非所有移动环境都允许您使用全套功能——例如,iOS 的 MonoTouch 没有在编译时无法确定的通用构造.您实际上是在使用 .NET 的一个非常小的子集(并且必须不断提醒自己可以在何处使用哪些功能),以便您可以在三个不同的平台上运行它们,而无需进行重大更改.

And since not all mobile environments enable you to use the full set of functionalities -- for example, MonoTouch for iOS does not generic constructs that cannot be determined at compile time. You're essentially using a very small subset of .NET (and must constant be reminding yourself what functionality can be used where) just so that you can run them all on three different platforms without significant changes.

当您为支持整个 .NET 功能集的 WP7 平台编写代码时,图像具有所有这些限制.我不了解你,但我会发疯的.而且您的 WP7 应用永远无法与其他应用竞争.

Now image having all these limitations when you are writing for the WP7 platform, which supports the entire .NET features set. I don't know about you, but I'll go crazy. And your WP7 app is never going to be even close to being competitive with other apps out there.

在我看来,痛苦和妥协是不值得的.你最终会得到三个马马虎虎的应用,这两个平台的用户都不会喜欢.

In my opinion, the pain and the compromises are not worth it. You'll end up with three so-so apps, which people in neither of the platforms are going to like.

除非所有优点都在于您的应用的后端逻辑,而且它是如此之好以至于人们会忽略 UI 问题只是为了获得您应用的后端功能.根据我的经验,这几乎从未发生过.

Unless all the goodness lies in your app's back-end logic, and it is so good that people are going to ignore UI issues just to get to your app's back-end functionalities. In my experience, this almost never happens.

这篇关于使用一种编程语言 (C#) 针对多个移动平台进行定位/开发?成本效益?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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