I’ve been so busy lately that I have neglected to write about a great platform for developing iOS applications called “MonoTouch.”
I recently released a new course on MonoTouch at Pluralsight.
I wanted to take a bit of time here to talk about MonoTouch and to tell you why you should be using it instead of developing iOS applications in Objective-C
When I first started developing with iOS, I firmly believed that the job should be done using the tools that Apple provided.
I still think it is a very good idea to learn Objective-C and how to develop an iOS application using Objective-C and XCode.
But I am convinced now that overall MonoTouch is the way to go.
Objective-C is a decent language, but it has a fairly steep learning curve for a C# or Java developer. XCode, the IDE for developing iOS applications, is a decent IDE, but it is not nearly as powerful as MonoDevelop or Visual Studio.
The reality of the situation is that Apple’s development platform is still back in 1990. Even though there have been some changes and growth, I firmly believe now that Objective-C and the underlying technology cannot ever catch up to .NET or Java.
I don’t say this lightly. As I said, before I developed a fairly large application in Objective-C. I authored a Pluralsight course on iOS development with Objective-C. I was pretty convinced this was the way to go until I gave MonoTouch a try.
An unfair test
I really gave MonoTouch an unfair test, but it passed anyway. I set out to learn, configure, build a MonoTouch application, and deploy it to the Apple App Store in 1 weekend.
I figured if MonoTouch could pass this test then I would immediately save more than the $400 cost for the software since the next application I was going to build was going to probably take at least a week worth of time to build in Objective-C.
MonoTouch easily passed my test and really exceeded my expectations.
The main advantage
By and far the main advantage in using MonoTouch is the language.
C#’s ability to wire up events through event handlers and delegates makes working with iOS so much easier.
There are many situations in iOS where you have to create a special class to act as a delegate for providing behavior for various iOS controls and classes. In C#, many of these delegate classes can be replaced by a C# delegate or lambda expression.
Another really painful situation in Objective-C is memory management. If you aren’t used to tracking memory usage it takes a bit to get adjusted to it in Objective-C. Sure, it really isn’t that hard, but once I started working with C# to build my iOS application, I realized how much faster I could fly through the code without having to even think about it. (The newer version of Objective-C has somewhat built in memory management, but it is not a true garbage collection implementation.)
Along with C#, you get the full power of the .NET framework. Almost all of the base class libraries from .NET are available in MonoTouch. (You basically have the silverlight .NET profile.)
This really comes in handy in 3 main areas:
- Working with XML
- Working with databases
- Calling web services
If you try to do these things in Objective-C, it is possible, but it will hurt like hell.
Give it a shot
If you are interested in developing iOS applications and you haven’t tried MonoTouch, go give it a try. Trust me, it is worth the effort. One of the big factors that had me developing Android applications and shying away from iOS was the hurdle of trying to learn and work with Objective-C.
MonoTouch lets you reuse your C# skills without any extra overhead, since the application is compiled down to native ARM assembly code.
If you don’t know where to get started or want to learn a little bit more about MonoTouch, feel free to check out my course on Pluralsight.
Kudos to the Xamarin team for building such a great product!
(BTW, that photo is me flipping. Actually it is a thing I used to call “throwing myself at the ground for dramatic effect.”)