I am the only mobile developer in my job. Before I was hired, my currently boss was thinking on using Xamarin as their marketing says the words Shared code and native. I consider myself an advanced Android developer since I've build large information systems. Right now I'm working on simple apps I could finish in a week, but Xamarin is giving me headache since its too buggy, and the reusable code is about 10% that could easily be copy/pasted into iOS
, and despite the fact that you can share that 10% code, sometimes you still have to use compilation directives #if / #endif
.
我是我工作中唯一的移动开发人员。在我被录用之前,我现在的老板正在考虑使用Xamarin作为他们的市场营销手段,比如“共享代码”和“本地语言”。我认为自己是一个高级的Android开发人员,因为我已经构建了大型的信息系统。现在我工作在简单的应用程序可以在一周内完成,但Xamarin的给我头痛以来太多漏洞,可重用代码大约是10%,可以很容易地复制/粘贴到iOS,尽管你可以共享,10%的代码,有时你还得使用编译指令#如果/ # endif。
I mean, there is no really any advantage for me, since I already know both Java
and Objective-C
languages. I already have vast knowledge of SQLite
and data storage with Core Data
on both iOS and Android SDK so that learning Xamarin will make it slower.
我的意思是,对我来说没有任何优势,因为我已经知道Java和Objective-C语言。我已经对SQLite和data storage有了丰富的知识,iOS和Android SDK都有核心的数据存储,所以学习Xamarin会比较慢。
I have already tried to talk them into not going for Xamarin since its only a little code you can share, but they don't seem either to understand.
我已经试着说服他们不要使用Xamarin了,因为这只是你可以分享的一小段代码,但他们似乎也不理解。
I need some good argument to convince them not to buy it, so I can do my job in a more productive and faster way. Thank you in advance.
我需要一些好的理由来说服他们不要买它,这样我就能以一种更高效、更快的方式完成我的工作。提前谢谢你。
1 个解决方案
#1
43
Some good points from Lee Whitney's Blog: Why I Don’t Recommend Xamarin for Mobile Development:
Lee Whitney的博客有一些很好的观点:为什么我不推荐Xamarin进行移动开发?
App Overhead
应用程序开销
Xamarin based apps have a built in overhead that makes them larger on average. This affects download time and storage used on a device. The minimum additional size is usually a few megabytes and can grow proportionately as the code uses more of the APIs. This is due to the way code from .NET assemblies is statically linked (as native code) into apps as the assemblies are referenced. On Android there is also an extra startup delay for apps for OS specific reasons. To Xamarin’s credit this overhead used to be much greater and the company has made great strides in reducing it. However, the impact on app users is still measureable.
基于Xamarin的应用程序有一个内置的开销,这使得它们的平均规模更大。这会影响设备上的下载时间和存储。最小的附加大小通常是几兆字节,随着代码使用更多的api,可以按比例增加。这是由于。net程序集的代码在程序集被引用时被静态地链接到应用程序中(作为本机代码)。在Android上,由于操作系统的特殊原因,也有额外的启动延迟。对Xamarin来说,这方面的开销过去要大得多,公司在减少这方面已经取得了长足的进步。然而,对应用用户的影响仍然是可以衡量的。
Limited Sharing of UI Code Across iOS and Android
iOS和Android用户界面代码共享受限
User Interface development is not portable between iOS and Android.
This means APIs, event logic, widgets, and designers must be used and coded differently for each platform. There are a few exceptions to this for common, low level operations.iOS和Android之间的用户界面开发是不可移植的。这意味着必须对每个平台使用api、事件逻辑、小部件和设计器,并对它们进行不同的编码。对于常见的低级别操作,有一些例外。
Xamarin would argue that trying to abstract UI APIs across very different platforms can create unnecessary complexity or lead to a poor user experience with an LCD (lowest common denominator) design. They have a point here. Titanium tries to do this partially, and the result has made many developers unhappy with the inconsistent or unpredictable results. HTML5 apps are more successful at pulling off this UI abstraction without forcing an LCD design, but they do not have the native performance of Xamarin.
Xamarin认为,试图将UI api抽象到不同的平台上,可能会造成不必要的复杂性,或者导致用户体验不佳,而使用LCD(最小公共性)设计。他们说的有道理。Titanium尝试部分实现这一点,结果使许多开发人员对不一致或不可预测的结果感到不满。HTML5应用程序更成功地实现了UI抽象,而不需要强制采用LCD设计,但它们没有Xamarin的本地性能。
UI problems can be some of the most time consuming aspects of developing mobile apps. Despite having a good justification, the important takeaway is that for many mobile UI problems, Xamarin will not save developers or designers time.
UI问题可能是开发移动应用程序最耗时的部分。尽管有很好的理由,重要的是对于许多移动UI问题,Xamarin不会节省开发人员或设计师的时间。
Limited Sharing of Code Outside of Xamarin
限制在Xamarin之外共享代码。
Xamarin does not allow creation of reusable components or modules outside of it’s own environment. For example, code written in Xamarin cannot be used in native or HTML5 apps. This means any code developed by a team using Xamarin cannot be shared or reused with teams using any other tooling for iOS and Android. How much this matters depends on the situation, but the problem with development is we can’t predict all of our situations. So it’s an uncomfortable limitation to have right out of the gate.
Xamarin不允许在自己的环境之外创建可重用的组件或模块。例如,用Xamarin编写的代码不能在本地或HTML5应用程序中使用。这意味着使用Xamarin的团队开发的任何代码都不能与使用其他工具的团队共享或重用。这有多重要取决于形势,但发展的问题是我们不能预测我们所有的情况。这是一个让人不舒服的限制。
Ecosystem and Community
生态系统和社会
This is something that is not really Xamarin’s fault. What company has a mobile ecosystem that matches Apple, Google, or HTML5? However, it matters. When developers are 10 times more likely to find results when searching the web about an issue, it directly impacts productivity. The ecosystem of available support, services, and 3rd party components, and related tooling is, and will continue to be, significantly smaller than for native or HTML5 based apps.
这并不是Xamarin的错。哪个公司的移动生态系统能与苹果、谷歌或HTML5匹敌?然而,它很重要。当开发人员在web上搜索某个问题时发现结果的可能性增加了10倍,这将直接影响到生产力。可用支持、服务、第三方组件和相关工具的生态系统是,而且将继续是,比基于本地或HTML5的应用程序小得多。
The Third Learning Curve
第三学习曲线
Some concepts and techniques require special knowledge specific to the Xamarin environment. This effectively adds a third learning curve for developers beyond programming language and native APIs. For example, developers having to understand iOS reference counting to avoid problems with Xamarin’s garbage collection (Is this a bug in MonoTouch GC?). Another example is data structures and generics working in subtly different ways (http://docs.xamarin.com/guides/ios/advanced_topics/limitations). These are the types of issues that are hard to see before you actually adopt a new platform, so they merit special consideration.
有些概念和技术需要专门针对Xamarin环境的知识。这有效地为开发人员增加了编程语言和本地api之外的第三个学习曲线。例如,开发人员必须了解iOS引用计数,以避免Xamarin的垃圾收集问题(这是MonoTouch GC中的一个bug吗?)另一个例子是数据结构和泛型以微妙不同的方式工作(http://docs.xamarin.com/guides/ios/advanced_topics/limitations)。这些是在实际采用新平台之前很难看到的问题类型,因此它们值得特别考虑。
More Moving Parts
更多的移动部件
Xamarin introduces it’s own set of bugs that affect product quality and developer productivity. The problem is not that Xamarin has a bad product, but that adding any large or complex system to the app toolchain comes with problems and bugs that do not exist in native apps.
Xamarin介绍了它自己的一组影响产品质量和开发人员生产力的bug。问题不在于Xamarin的产品不好,而在于向应用程序工具链中添加任何大型或复杂的系统都会带来本地应用程序中不存在的问题和bug。
The historical record of these bugs can be reviewed using Xamarin’s bug tracker (https://bugzilla.xamarin.com).
可以使用Xamarin的bug跟踪器(https://bugzilla.xamarin.com)查看这些bug的历史记录。
Yes, all software has bugs. The point is when you measure the advantage of adding new tools; the disadvantage of new problems must be factored in.
是的,所有的软件都有缺陷。关键是当您衡量添加新工具的优势时;新问题的缺点必须考虑在内。
Summary
总结
In the end we have to try and quantify the benefits of a development abstraction like Xamarin over other abstractions, or over native development. Is C# better than Objective-C? Yes, by far in my opinion, but that’s only one factor. When you add everything up it tips the scales away from Xamarin in favor of other approaches to mobile development. As of 2013 (this stuff can change quickly) I tend to choose a native code solution or an HTML5/Cordova solution. I like both for different reasons and will try to explain some of the decision factors in another article.
最后,我们必须尝试量化开发抽象的好处,比如在其他抽象或本地开发之上使用Xamarin。c#是否比Objective-C好?是的,在我看来,这只是一个因素。当你把所有的东西都加起来的时候,它就会使你远离Xamarin,转而使用移动开发的其他方法。2013年,我倾向于选择原生代码解决方案或HTML5/Cordova解决方案。出于不同的原因,我喜欢两者,并将在另一篇文章中解释一些决策因素。
#1
43
Some good points from Lee Whitney's Blog: Why I Don’t Recommend Xamarin for Mobile Development:
Lee Whitney的博客有一些很好的观点:为什么我不推荐Xamarin进行移动开发?
App Overhead
应用程序开销
Xamarin based apps have a built in overhead that makes them larger on average. This affects download time and storage used on a device. The minimum additional size is usually a few megabytes and can grow proportionately as the code uses more of the APIs. This is due to the way code from .NET assemblies is statically linked (as native code) into apps as the assemblies are referenced. On Android there is also an extra startup delay for apps for OS specific reasons. To Xamarin’s credit this overhead used to be much greater and the company has made great strides in reducing it. However, the impact on app users is still measureable.
基于Xamarin的应用程序有一个内置的开销,这使得它们的平均规模更大。这会影响设备上的下载时间和存储。最小的附加大小通常是几兆字节,随着代码使用更多的api,可以按比例增加。这是由于。net程序集的代码在程序集被引用时被静态地链接到应用程序中(作为本机代码)。在Android上,由于操作系统的特殊原因,也有额外的启动延迟。对Xamarin来说,这方面的开销过去要大得多,公司在减少这方面已经取得了长足的进步。然而,对应用用户的影响仍然是可以衡量的。
Limited Sharing of UI Code Across iOS and Android
iOS和Android用户界面代码共享受限
User Interface development is not portable between iOS and Android.
This means APIs, event logic, widgets, and designers must be used and coded differently for each platform. There are a few exceptions to this for common, low level operations.iOS和Android之间的用户界面开发是不可移植的。这意味着必须对每个平台使用api、事件逻辑、小部件和设计器,并对它们进行不同的编码。对于常见的低级别操作,有一些例外。
Xamarin would argue that trying to abstract UI APIs across very different platforms can create unnecessary complexity or lead to a poor user experience with an LCD (lowest common denominator) design. They have a point here. Titanium tries to do this partially, and the result has made many developers unhappy with the inconsistent or unpredictable results. HTML5 apps are more successful at pulling off this UI abstraction without forcing an LCD design, but they do not have the native performance of Xamarin.
Xamarin认为,试图将UI api抽象到不同的平台上,可能会造成不必要的复杂性,或者导致用户体验不佳,而使用LCD(最小公共性)设计。他们说的有道理。Titanium尝试部分实现这一点,结果使许多开发人员对不一致或不可预测的结果感到不满。HTML5应用程序更成功地实现了UI抽象,而不需要强制采用LCD设计,但它们没有Xamarin的本地性能。
UI problems can be some of the most time consuming aspects of developing mobile apps. Despite having a good justification, the important takeaway is that for many mobile UI problems, Xamarin will not save developers or designers time.
UI问题可能是开发移动应用程序最耗时的部分。尽管有很好的理由,重要的是对于许多移动UI问题,Xamarin不会节省开发人员或设计师的时间。
Limited Sharing of Code Outside of Xamarin
限制在Xamarin之外共享代码。
Xamarin does not allow creation of reusable components or modules outside of it’s own environment. For example, code written in Xamarin cannot be used in native or HTML5 apps. This means any code developed by a team using Xamarin cannot be shared or reused with teams using any other tooling for iOS and Android. How much this matters depends on the situation, but the problem with development is we can’t predict all of our situations. So it’s an uncomfortable limitation to have right out of the gate.
Xamarin不允许在自己的环境之外创建可重用的组件或模块。例如,用Xamarin编写的代码不能在本地或HTML5应用程序中使用。这意味着使用Xamarin的团队开发的任何代码都不能与使用其他工具的团队共享或重用。这有多重要取决于形势,但发展的问题是我们不能预测我们所有的情况。这是一个让人不舒服的限制。
Ecosystem and Community
生态系统和社会
This is something that is not really Xamarin’s fault. What company has a mobile ecosystem that matches Apple, Google, or HTML5? However, it matters. When developers are 10 times more likely to find results when searching the web about an issue, it directly impacts productivity. The ecosystem of available support, services, and 3rd party components, and related tooling is, and will continue to be, significantly smaller than for native or HTML5 based apps.
这并不是Xamarin的错。哪个公司的移动生态系统能与苹果、谷歌或HTML5匹敌?然而,它很重要。当开发人员在web上搜索某个问题时发现结果的可能性增加了10倍,这将直接影响到生产力。可用支持、服务、第三方组件和相关工具的生态系统是,而且将继续是,比基于本地或HTML5的应用程序小得多。
The Third Learning Curve
第三学习曲线
Some concepts and techniques require special knowledge specific to the Xamarin environment. This effectively adds a third learning curve for developers beyond programming language and native APIs. For example, developers having to understand iOS reference counting to avoid problems with Xamarin’s garbage collection (Is this a bug in MonoTouch GC?). Another example is data structures and generics working in subtly different ways (http://docs.xamarin.com/guides/ios/advanced_topics/limitations). These are the types of issues that are hard to see before you actually adopt a new platform, so they merit special consideration.
有些概念和技术需要专门针对Xamarin环境的知识。这有效地为开发人员增加了编程语言和本地api之外的第三个学习曲线。例如,开发人员必须了解iOS引用计数,以避免Xamarin的垃圾收集问题(这是MonoTouch GC中的一个bug吗?)另一个例子是数据结构和泛型以微妙不同的方式工作(http://docs.xamarin.com/guides/ios/advanced_topics/limitations)。这些是在实际采用新平台之前很难看到的问题类型,因此它们值得特别考虑。
More Moving Parts
更多的移动部件
Xamarin introduces it’s own set of bugs that affect product quality and developer productivity. The problem is not that Xamarin has a bad product, but that adding any large or complex system to the app toolchain comes with problems and bugs that do not exist in native apps.
Xamarin介绍了它自己的一组影响产品质量和开发人员生产力的bug。问题不在于Xamarin的产品不好,而在于向应用程序工具链中添加任何大型或复杂的系统都会带来本地应用程序中不存在的问题和bug。
The historical record of these bugs can be reviewed using Xamarin’s bug tracker (https://bugzilla.xamarin.com).
可以使用Xamarin的bug跟踪器(https://bugzilla.xamarin.com)查看这些bug的历史记录。
Yes, all software has bugs. The point is when you measure the advantage of adding new tools; the disadvantage of new problems must be factored in.
是的,所有的软件都有缺陷。关键是当您衡量添加新工具的优势时;新问题的缺点必须考虑在内。
Summary
总结
In the end we have to try and quantify the benefits of a development abstraction like Xamarin over other abstractions, or over native development. Is C# better than Objective-C? Yes, by far in my opinion, but that’s only one factor. When you add everything up it tips the scales away from Xamarin in favor of other approaches to mobile development. As of 2013 (this stuff can change quickly) I tend to choose a native code solution or an HTML5/Cordova solution. I like both for different reasons and will try to explain some of the decision factors in another article.
最后,我们必须尝试量化开发抽象的好处,比如在其他抽象或本地开发之上使用Xamarin。c#是否比Objective-C好?是的,在我看来,这只是一个因素。当你把所有的东西都加起来的时候,它就会使你远离Xamarin,转而使用移动开发的其他方法。2013年,我倾向于选择原生代码解决方案或HTML5/Cordova解决方案。出于不同的原因,我喜欢两者,并将在另一篇文章中解释一些决策因素。