Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monotouch or Titanium for rapid application development on IPhone?

As a .Net developer I always dreamed for the possibility to develop with my existing skills (c#) applications for the Iphone.

Both programs require a Mac and the Iphone Sdk installed.

Appcelerator Titanium was the first app I tried and it is based on exposing some Iphone native api to javascript so that they can be called using that language.

Monotouch starts at $399 for beeing able to deploy on the Iphone and not on the Iphone simulator while Titanium is free.

Monotouch (Monodevelop) has an Ide that is currently missing in Titanium (but you can use any editor like Textmate, Aptana...)

I think both program generate at the end a native precompiled app (also if I am not sure about the size of the final app on the Iphone as I think the .Net framework calls are prelilnked at compilation time in Monotouch).

I am also not sure about the full coverage of all the Iphone api and features.

Titanium has also the advantage to enable Android app development but as a c# developer I still find Monotouch experience more like the Visual Studio one.

Which one would you choose and what are your experiences on Monotouch and Titanium?

like image 815
Ronnie Avatar asked Sep 28 '09 17:09

Ronnie


3 Answers

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 goferit. 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.

I'll shut up now.

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.

Aright.

Really shutting up now... I hope this helps.

like image 55
Rory Blyth Avatar answered Nov 01 '22 20:11

Rory Blyth


These are fun and interesting ways you can build iPhone apps. But, for truly rapid native iPhone development, your best bet is the free iPhone SDK and Xcode.

To be honest, the hardest things to learn are the capabilities of the frameworks themselves, NOT the language syntax. But that is an issue you have to tackle either way as these IDEs/Languages still require you to grasp some of the conventions of Cocoa (and Cocoa Touch).

I don't say this as a Cocoa / Objective-C snob, but if you know C (which as a C# dev you do) there really isn't any barrier to entry.

In addition, you will have access to tons of tutorials and sample code that just won't be available for these fledgling translators/IDEs/languages.

Learning another programming language is rarely a bad thing, and as an experienced programmer, your time investment won't be as large as you think.

like image 4
Corey Floyd Avatar answered Nov 01 '22 21:11

Corey Floyd


I've created an open source project http://propertycross.com that helps developers select a cross-platform mobile framework by showing the same application implemented with Sencha, Titanium, Xamarin and more. This project allows you to easily compare a wide range of frameworks in terms of end-user experience, code, IDE, developer experience etc ...

like image 3
ColinE Avatar answered Nov 01 '22 21:11

ColinE