Monotouch or Titanium for rapid application development on IPhone?

Like any which-tool-or-platform-or-language-or-framework-or-whatever question, it should really come down to what you want.

Forget all the if-you-want-to-develop-for-this-platform-then-you-have-to-pay-your-dues advice. If you’re interested in learning Objective-C, Xcode, and associated Apple bits, then go for it. I did. It’s been fun, but my interest was in developing iPhone apps. Learning a new language, framework, and IDE was just a bonus (I like this stuff). It was also necessary when I started.

I’ve been working with MonoTouch since it was released, and I love it. I prefer C# to Objective-C, and I like having access to the subset of the .Net (Mono) framework that MonoTouch provides. There are certain things that are simply easier to do with .Net than Cocoa (string manipulation, date manipulation, anything XML, etc.).

I also like not having to deal with reference-counting anymore. I was spoiled by years of not having to keep track of resources at that level. I don’t mind having to clean up after myself, but I don’t want to have to manually do something that every other modern dev platform I’ve used does for me automatically. Plus, even for seasoned Objective-C devs, reference-counting isn’t a no-brainer. Scroll through OS X’s console output sometime to see how many apps crash due to memory-management issues (I know – this can happen with basically any app, but it’s far easier to make the mistakes that lead to this situation when you get overworked devs involved whose attention spans have been destroyed by twelve hours of if this and if that and else this and else that and blah blah blah).

I still use Objective-C/Xcode – I’ve really learned to like Apple’s tools. I honestly feel they’re awkward and a bit arcane, but still fun.

But… then I also like this:

public string SomeString { get; set; }

To do the same thing with Objective-C (on the iPhone, anyway) requires that you declare a local variable to back the property, write the property declaration, and then use the “synthesize” directive to have the property generated for you (depending on what property attributes you specify, you might have a property that wraps getters and setters that take care of reference-counting for you – overall, this is a time-saver, but the C# Way is the clear winner here).

That’s just one example of how MonoTouch can make your life easier, especially if you’re used to .Net/Java/Python/other languages that don’t require that you get your fingers dirty with memory-mangement (unless you want to).

As far as iPhone-ness is concerned, aside from brining part of .Net to the iPhone world, the MonoTouch namespace maps to CocoaTouch, so if you’re confused about, say, the MonoTouch UIViewController, you can just hop over to Apple’s docs on the UIViewController. MonoTouch .Net-izes CocoaTouch, but it’s close enough that you’re unlikely to hit a wall (that wouldn’t have also hit if you were using Xcode/Objective-C). It’s slick.

Titanium is different. Since they’re trying (trying) to create an abstraction layer that lets you write the same app for multiple platforms, you’re going to deal with the usual drawbacks: Totally different APIs, loss of flexibility (the same could be said of MonoTouch, but not remotely to the same degree), and basically having to learn a whole new platform (which is what you’re trying to avoid by getting around Xcode/Objective-C/CocoaTouch, right?).

I also hate JavaScript, so I’m going to be biased against Titanium. But even if that weren’t the case – even if I could use a language I do like – the APIs don’t tickle my fancy. Or my anything.

Regardless of the dev tools you choose, you will end up having to learn something about CocoaTouch. Whether it’s Xcode/Objective-C, MonoTouch, or Titanium, something is going to break or go all wonky on you, and you’re eventually going to have to refer to CocoaTouch documentation.

If I were giving a talk on iPhone development (which I have, and which I will be doing again), and if I were to discuss alternatives to Apple’s dev tools (which I will), I would still strongly encourage devs to at least work through a few basic iPhone apps using the native tools. It’s going to make you a better developer for the platform – period. And you can use this beginning phase to determine if you even want to use anything other than the free Apple-supplied bits. You might not. I’ve been using MonoTouch because it pleases me – not because it’s necessary.

So, to summarize a few basic criteria:

  • Preference (language/frameworks)

  • Devices (do you care about non-iPhone platforms or think you might someday?)

  • Comfort (if you like and know C# MUCH better than Objective-C, there’s no reason not to go with MonoTouch)

And don’t listen to the naysayers unless they’ve actually used the tech they’re talking about. For example, I’ve read about Titanium, but I’m not experienced with it – I just know that I don’t want anything to do with it on account of my preferences. That doesn’t make it “bad” – just something I don’t want in my life.

The Objective-C crowd can be impressively zealous. While there are plenty of open-minded devs in it, there are so, so, so many who think Objective-C and Cocoa and blah blah blah are THE last dev tools devkind will ever need.

Ignore them.

If you’re worried about support, here’s some stuff to consider:

  • Apple is likely to remain current, as they’re the ones making this junk.

  • MonoTouch is likely to remain current – the Mono peeps have done an amazing job keep up with Microsoft, and I see no reason why they won’t do the same with Apple. I’m blown away by what they do. And despite MonoTouch having been released, like, five minutes ago, they already have an update out for iPhone 3.1 stuff. They’re serious about this, and I think they’re magic. They’re the Keebler Elves of the dev world. They sit in their secret layers and crank out stuff everybody (ok – not everybody) likes, but that nobody else would even attempt to do.

  • Titanium is either going to become an awkward unified API for writing apps for multiple platforms that is entirely its own thing, or it’s going to become more and more splintered as the capabilities of different platforms diverge. Yeah, that’s a bunch of typical armchair nerdly future-gazing… I should have prefaced this bullet item with “It’s my opinion that…” If only there were a way to go back and change it.

Go with what you like. MonoTouch is a “safe” alternative to Apple’s stuff. I’m afraid Titanium is going to go down the same old oops-this-super-high-level-platform-abstraction-layer-stuff-doesn’t-really-work road that so many other technologies have. But if you’re doing something simple, there’s no harm in giving it a shot, especially considering that it’s free during the beta period.

Leave a Comment