I've been following the development of the Mono platform since its inception, from its early days as an open-source, cross-platform alternative to the .NET Framework to the introduction of MonoTouch on iOS and more recently the introduction of Mono for Android. Many in the .NET development community thought it was the end of the road for this technology when Attachmate acquired Novell (the commercial entity behind MonoTouch and Mono for Android). But fortunately for .NET developers, Miguel de Icaza, the original Mono project director, along with several of his former co-workers, rescued the Mono platform from carbonite freezing by licensing the technology from Attachmate, forming a new company called Xamarin, and using the technology as the basis for new releases of the MonoTouch and Mono for Android mobile development products.

Xamarin enhanced these new product versions to support the cutting-edge OS releases from Apple and Google, once again making MonoTouch and Mono for Android viable, native mobile application development platforms for C# .NET developers. Here I'll offer my impressions of the most recent versions of these two products, MonoTouch Professional 5.0 and Mono for Android 1.0.

MonoTouch Professional 5.0

The majority of what I had to say about MonoTouch was covered in my July 2010 review of MonoTouch Enterprise. Because the new MonoTouch supports Apple's latest iOS 5 release (which includes services for iCloud, Twitter integration, Core Image filters, and Apple's Newsstand push-data interfaces), MonoTouch 5.0 requires Xcode 4.2 running on Mac OS X 10.7. MonoTouch 5.0 also requires Xamarin's free MonoDevelop 2.8 IDE for writing C# code. And yes, developers still need to design their applications' user interfaces (UIs) via Apple's Interface Builder (now integrated as part of the Xcode 4.2 environment) rather than a Visual Studio-style form builder. For those who have never developed on the Apple platform, learning this distinct UI design approach is initially uncomfortable. But once you have gone through the process a few times, the concept of actions and outlets starts to take hold.

Xamarin has made several improvements to the MonoDevelop IDE, shown in Figure 1.

141871_fig1_MonoTouch_ MonoDevelop_IDE-sm
Figure 1: MonoTouch hosted in the MonoDevelop IDE

Although MonoDevelop is still not nearly as sophisticated as Visual Studio, MonoDevelop's UI has been cleaned up and modernized. MonoDevelop now includes features such as integrated version-control support for Git and Apple-specific support for iOS 5 Storyboards, iOS Info.plist application settings, and support for the free TestFlight iOS beta testing, beta distribution, and testing service. These improvements bring the product to parity with a native Objective-C-based iOS SDK Xcode 4.2 environment. These improvements, combined with all the benefits of memory protection, the vastness of .NET libraries, and the familiarity of C# classes in one platform, make MonoDevelop a powerful mobile IDE.

For C# developers who have already used an earlier version of MonoTouch, the MonoTouch Professional 5.0 upgrade is a no-brainer. Xamarin honors license agreements of customers who bought MonoTouch when Novell hosted the product and offers special upgrade pricing for those who qualify for it.

Mono for Android

Of the two Mono-related releases, Mono for Android is the newest addition to the Mono product family. It is also the one that, at least for me, is a harder sell. First, unlike Objective-C, Java -- the language of Android app development -- is relatively easy for C# developers to learn, because it is closely related to C# in syntax and sandboxing benefits. Thus, in Mono for Android's case, the advantage of providing a .NET-friendly development environment is somewhat less compelling than it is with MonoTouch. Second, Android is already cross-platform and can be developed on a Windows, Mac, or even Linux computer, and the development environment is free. Third, the advantage of sharing code between Mono for Android and MonoTouch applications is greatly diluted because the UI definitions, proprietary SDK function calls, and even resource assets are mostly specific to each target platform. Finally, the bulky Mono runtime that has to be either compiled into the application's resource bundle or installed as a separate runtime adds considerable overhead and start-up time, especially for small applications.

That said, I have to commend Xamarin for the company's remarkable Android efforts, particularly since Xamarin's is the only third-party Android development environment I've seen that produces truly native look-and-feel apps. Other development environments either use their own proprietary UI elements or, as PhoneGap or Rhomobile do, use HTML form elements within a WebKit browser-hosted container. As such, C# developers who don't have the time to learn Java and the variety of Java libraries for programming XML parsing, network I/O, and so on will find Mono for Android to be the only game in town.

Mono for Android applications can be created with the same MonoDevelop IDE used for MonoTouch development. But the more likely scenario for .NET developers will be to use Mono for Android's Visual Studio plug-in, shown in Figure 2.

141871_fig2_Mono_Android_VS_plug-in-sm
Figure 2: Using Mono for Android's Visual Studio plug-in

Not only does the Visual Studio plug-in allow seasoned C# developers to use one of the best IDEs on the planet, by using the plug-in developers can also leverage any commercial add-ons and features already designed for Visual Studio (e.g., DevExpress's CodeRush, JetBrains' ReSharper). Mono for Android's installer will auto-detect the presence of Visual Studio and configure it accordingly. The installer will also automatically download and install the necessary Android SDK components (including the Java runtime, the Android SDK, MonoDevelop, and the various Mono dependencies) and set them up for you.

As I mentioned earlier, code reuse between Mono for Android and MonoTouch is a possibility, but only for those who have invested the up-front time and effort in engineering the application to abstract UIs and platform SDK-specific calls. Otherwise, attempting to reuse code between the two platforms will likely prove futile.

Sizing Up the Platforms

Online documentation is still a weak spot for both MonoTouch and Mono for Android, though it is getting better. Several books have been published to help developers tackle the Mono learning curve. Both technologies have dedicated developer forums on the Xamarin website as well as a fair number of Q&A posts on Stackoverflow.com.

Xamarin has done an incredible amount of work rebranding and polishing the MonoTouch and Mono for Android properties. MonoTouch continues to provide an excellent non-Apple alternative to building native applications on the iOS platform. And although I am still not convinced that Mono for Android is a better solution than the native Java-based Android SDK, Mono for Android is a significant improvement over its Novell-owned predecessor.

Both products offer .NET developers a viable solution that can help them get their mobile applications to market more quickly. If Xamarin can find a way to enable native mobile application development from a single C# project code base, the company will have a killer combination. At very least, Xamarin should provide templates and tutorials that promote code-reuse best practices between the two platforms. For example, Xamarin should add a feature that asks the user (i.e., in a new project wizard) whether the app will be deployed to iOS, Android, or both and sets up the project stubs accordingly with a healthy dose of comments indicating where to code safely and where to isolate assets for platform-specific deployment. The addition of such features to support code reuse would make Mono for Android vastly more valuable compared with its currently available release and would make MonoTouch an even more compelling product than it is now.

MonoTouch Professional 5.0

PROS: Lets .NET developers use their C# skills to build cutting-edge iOS apps
CONS: Provides a less-sophisticated IDE than Visual Studio; lacks code-reuse support
RATING: 5 out of 5 stars
PRICE: $249 upgrade, $399 (includes annual support subscription)
RECOMMENDATION: For .NET developers who want to develop mobile apps for Apple platforms, MonoTouch is the tool of choice.
CONTACT: Xamarincontact@xamarin.com

Mono for Android

PROS: Produces truly native look-and-feel Android apps; includes Visual Studio add-in
CONS: Provides weak cost-benefit relative to free, native Java-based Android SDK; lacks code-reuse support
RATING: 3 out of 5 stars
PRICE: $249 upgrade, $399 (includes annual support subscription)
RECOMMENDATION: For C# developers who don't have time to learn Java, Mono for Android offers a viable solution for developing Android apps.
CONTACT: Xamarincontact@xamarin.com


Mike Riley is an advanced computing professional specializing in emerging technologies and new development trends. He is also a contributing editor for Dev Pro.