如何在 MonoTouch 和 Objective-C 之间做出选择? [英] How to decide between MonoTouch and Objective-C?

查看:14
本文介绍了如何在 MonoTouch 和 Objective-C 之间做出选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天在当地的 .Net 活动中参加了 Mono 会议后,触及"了使用 MonoTouch 作为 iPhone 开发的替代方案.在 C# 和 .Net 中非常舒服,尽管 Mono 堆栈有些古怪,但它似乎是一个吸引人的选择.但是,由于 MonoTouch 的价格为 400 美元,所以我对 iPhone 开发的方式是否如此感到有些困惑.

After sitting through a session today on Mono at a local .Net event, the use of MonoTouch was 'touched' upon as an alternative for iPhone development. Being very comfortable in C# and .Net, it seems like an appealing option, despite some of the quirkiness of the Mono stack. However, since MonoTouch costs $400, I'm somewhat torn on if this is the way to go for iPhone development.

有没有人有使用 MonoTouch 和 Objective-C 进行开发的经验,如果有的话,使用 MonoTouch 进​​行开发是否比学习 Objective-C 更简单、更快捷,而且价值 400 美元?

Anyone have an experience developing with MonoTouch and Objective-C, and if so is developing with MonoTouch that much simpler and quicker than learning Objective-C, and in turn worth the $400?

推荐答案

我最近经常看到这个问题(及其变体).令我惊讶的是人们回复的频率如此之高,但回复的人数却如此之少.

I've seen this question (and variations on it) a lot lately. What amazes me is how often people respond, but how few answer.

我有自己的偏好(我喜欢两个堆栈),但这是大多数答案"开始出错的地方.它不应该是关于我想要什么(或其他人想要什么).

I have my preferences (I enjoy both stacks), but this is where most "answers" start to go wrong. It shouldn't be about what I want (or what anybody else wants).

以下是我如何确定 MonoTouch 的价值 - 显然,我不能客观,但我认为这非常不狂热:

Here's how I'd go about determining the value of MonoTouch - I can't be objective, obviously, but I think this is pretty zealotry-free:

  • 这是为了娱乐还是为了生意?如果您想从事该领域的咨询工作,您可以很快收回 399 美元.

  • Is this for fun or business? If you wanted to get into consulting in this area, you could make your $399 back very quickly.

您是想从内到外学习该平台,还是只是"想为其编写应用程序?

Do you want to learn the platform inside-out, or do you "just" want to write apps for it?

您是否足够喜欢 .Net,以至于使用不同的开发堆栈会为您带来乐趣?同样,我喜欢两种堆栈(Apple 和 Mono),但对我来说 MonoTouch 使体验变得更加有趣.我并没有停止使用 Apple 的工具,但这主要是因为我真的很喜欢这两个堆栈.我喜欢 iPhone,也喜欢 .Net.在那种情况下,对我来说,MonoTouch 是轻而易举的事.

Do you like .Net enough that using a different dev stack would take the fun out of it for you? Again, I like both stacks (Apple and Mono), but for me MonoTouch makes the experience that much more fun. I haven't stopped using Apple's tools, but that's mainly because I really do enjoy both stacks. I love the iPhone, and I love .Net. In that case, for me, MonoTouch was a no-brainer.

你觉得用 C 工作舒服吗?我指的不是 Objective-C,而是 C - 这很重要,因为 Objective-C C.这是一个不错的、漂亮的、友好的 OO 版本,但是如果指针给你带来了heebie-jeebies,MonoTouch 是你的朋友.如果碰巧您喜欢指针(或 C 等),请不要听信那些认为您是开发人员的反对者.我曾经带着一份 IBM ROM BIOS Pocket Reference 四处走动,当我编写程序集并强制我的计算机进入有趣的视频模式并为它们和(公认的垃圾)窗口系统编写我自己的字体渲染位时,我没有不要认为 QuickBasic 开发人员是笨蛋.我一个 QuickBasic 开发者(除了其他人).永远不要屈服于书呆子大男子主义.如果你不喜欢 C,如果你不喜欢指针,如果你想尽可能远离手动内存管理(公平地说,它在 ObjC 中一点也不差),那么... 单触.也不要大意.

Do you feel comfortable working with C? I don't mean Objective-C, but C - it matters because Objective-C is C. It's a nice, fancy, friendly OO version, but if pointers give you the heebie-jeebies, MonoTouch is your friend. And don't listen to the naysayers who think you're a dev wuss if it happens that you don't like pointers (or C, etc.). I used to walk around with a copy of the IBM ROM BIOS Pocket Reference, and when I was writing assembly and forcing my computer into funny video modes and writing my own font rendering bits for them and (admittedly trashy) windowing systems, I didn't think the QuickBasic devs were wusses. I was a QuickBasic dev (in addition to the rest). Never give in to nerd machismo. If you don't like C, and if you don't like pointers, and if you want to stay as far away from manual memory management as possible (and, to be fair, it's not bad at all in ObjC), then... MonoTouch. And don't take any guff for it.

您想定位用户还是企业?这对我来说并不重要,但仍然有人在 Edge 上,事实是:如果您使用 Apple 的堆栈,您可以创建一个小得多的下载包.我一直在玩 MonoTouch,我有一个不错的小应用程序,一旦压缩,它就会减少到大约 2.7 MB(当提交你的应用程序进行分发时,你将它压缩——当应用程序从商店下载时,它们"重新压缩 - 因此,在确定您的应用程序是否会低于 10MB OTA 限制时,请先压缩吸盘 - MonoTouch 会给您带来惊喜).但是,撇开 MT 的快乐不谈,如果您的目标是最终用户,则半兆与近三兆(例如)对您来说可能很重要.如果您正在考虑企业工作,那么几 MB 根本无关紧要.而且,要明确一点 - 我很快就会向商店提交一个基于 MT 的应用程序,我对大小没有任何问题.根本不打扰我.但如果这是关心的事情,那么 Apple 的堆栈会赢得这一点.

Would you like to target users or businesses? It doesn't matter much to me, but there are still people out there on Edge, and the fact is: you can create a far smaller download package if you use Apple's stack. I've been playing around with MonoTouch, and I have a decent little app going that, once compressed, gets down to about 2.7 MB (when submitting your app for distribution, you zip it - when apps are downloaded from the store, they're zipped - so when figuring out if your app is going to come in under the 10MB OTA limit, zip the sucker first - you WILL be pleasantly surprised with MonoTouch). But, MT happiness aside, half a meg vs. nearly three (for example) is something that might be important to you if you're targeting end users. If you're thinking of enterprise work, a few MB won't matter at all. And, just to be clear - I'm going to be submitting a MT-based app to the store soonishly, and I have no problem whatsoever with the size. Doesn't bother me at all. But if that's something that would concern you, then Apple's stack wins this one.

做任何 XML 工作吗?单触.期间.

Doing any XML work? MonoTouch. Period.

字符串操作?日期操纵?我们已经习惯了 .Net 的一切和厨房水槽框架的其他一百万件小事?单点触控.

String manipulation? Date manipulation? A million other little things we've gotten used to with .Net's everything-AND-the-kitchen-sink frameworks? MonoTouch.

网络服务?单点触控.

在语法上,它们都有各自的优势.Objective-C 往往更冗长你必须编写它.您会发现自己使用 C# 编写代码,而不必使用 ObjC 编写代码,但它是双向的.这个特定的主题可以填满一本书.我更喜欢 C# 语法,但在克服了我最初对 Objective-C 的这种超凡脱俗的反应之后,我学会了享受它.我在谈话中取笑了它(对于习惯于 C#/Java/等的开发人员来说这很奇怪),但事实是我在我的让我快乐的心.

Syntactically, they both have their advantages. Objective-C tends to be more verbose where you have to write it. You'll find yourself writing code with C# you wouldn't have to write with ObjC, but it goes both ways. This particular topic could fill a book. I prefer C# syntax, but after getting over my initial this-is-otherworldly reaction to Objective-C, I've learned to enjoy it quite a bit. I make fun of it a bit in talks (it is weird for devs who're used to C#/Java/etc.), but the truth is that I have an Objective-C shaped spot in my heart that makes me happy.

您打算使用 Interface Builder 吗?因为,即使在这个早期版本中,我发现自己用 IB 构建 UI 并在代码中使用它们的工作要少得多.感觉就像 Objective-C/IB 的做事方式缺少整个步骤,我很确定这是因为 Objective-C/IB 的做事方式缺少整个步骤.到目前为止,我认为我还没有进行充分的测试,但是到目前为止,MonoTouch 是这里的赢家,因为您需要做的工作更少.

Do you plan to use Interface Builder? Because, even in this early version, I find myself doing far less work to build my UIs with IB and then using them in code. It feels like entire steps are missing from the Objective-C/IB way of doing things, and I'm pretty sure it's because entire steps are missing from the Objective-C/IB way of doing things. So far, and I don't think I've sufficiently tested, but so far, MonoTouch is the winner here for how much less work you have to do.

您认为学习新的语言和平台很有趣吗?如果是这样,iPhone 可以提供很多东西,而 Apple 的堆栈可能会让你走出舒适区——对于某些开发者来说,这很有趣(我是这些开发者之一- 我拿它开玩笑,让 Apple 很为难,但我在通过 Apple 的工具学习 iPhone 开发过程中获得了很多乐趣).

Do you think it's fun to learn new languages and platforms? If so, the iPhone has a lot to offer, and Apple's stack will likely get you out of your comfort-zone - which, for some devs, is fun (Hi - I'm one of those devs - I joke about it and give Apple a hard time, but I've had a lot of fun learning iPhone development through Apple's tools).

要考虑的事情太多了.价值是如此抽象.如果我们谈论的是成本以及它是否值得,那么答案归结为我的第一个要点:如果这是为了生意,如果你能得到这份工作,你就会马上赚回你的钱.

There are so many things to consider. Value is so abstract. If we're talking about cost and whether it's worth it, the answer comes down to my first bullet item: if this is for business, and if you can get the work, you'll make your money right back.

所以……这已经是我能做到的客观了.这是您可能会问自己的问题的简短列表,但它只是一个起点.

So... that's about as objective as I can be. This is a short list of what you might ask yourself, but it's a starting point.

就个人而言(让我们暂时放弃客观性),我喜欢并使用两者.我很高兴我首先学习了 Apple 堆栈.当我已经熟悉 Apple 的世界时,使用 MonoTouch 对我来说更容易上手和运行.正如其他人所说,您仍将使用 CocoaTouch - 它只是在 .Net 化环境中.

Personally (let's drop the objectivity for a moment), I love and use both. And I'm glad I learned the Apple stack first. It was easier for me to get up and running with MonoTouch when I already knew my way around Apple's world. As others have said, you're still going to be working with CocoaTouch - it's just going to be in a .Net-ized environment.

但还有更多.没有使用过 MonoTouch 的人往往会止步于此——这是一个包装器等等"——那不是 MonoTouch.

But there's more than that. The people who haven't used MonoTouch tend to stop there - "It's a wrapper blah blah blah" - that's not MonoTouch.

MonoTouch 使您可以访问 CocoaTouch 所提供的内容,同时还使您可以访问 .Net 所提供的内容(一个子集),一个有些人觉得更舒服的 IDE(我是其中之一),更好的集成使用 Interface Builder,虽然您不会完全忘记内存管理,但您可以获得很大的回旋余地.

MonoTouch gives you access to what CocoaTouch has to offer while also giving you access to what (a subset of) .Net has to offer, an IDE some people feel more comfortable with (I'm one of them), better integration with Interface Builder, and although you don't get to completely forget about memory-management, you get a nice degree of leeway.

如果您不确定,请获取 Apple 的堆栈(免费),然后获取 MonoTouch 评估堆栈(免费).在您加入 Apple 的开发计划之前,两者都只能在模拟器上运行,但这足以帮助您确定您是否非常喜欢另一个,以及 MonoTouch 对您来说是否值 399 美元.

If you aren't sure, grab Apple's stack (it's free), and grab the MonoTouch eval stack (it's free). Until you join Apple's dev program, both will only run against the simulator, but that's enough to help you figure out if you vastly prefer one to the other, and possible whether MonoTouch is, for you, worth the $399.

不要听那些狂热分子的话——他们往往没有使用他们所反对的技术:)

And don't listen to the zealots - they tend to be the ones who haven't used the technology they're railing against :)

这篇关于如何在 MonoTouch 和 Objective-C 之间做出选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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