Mobile

Xamarin 2.0 Review

Android Development

Because Google's Android's SDK runs on Windows, Mac, and Linux, Xamarin Studio Android applications can be deployed and debugged from either the Windows or Mac platform. Users of the Business edition will also benefit from the Visual Studio integration, allowing Android applications to be coded and managed entirely within the Visual Studio IDE (Figure 4). While the Xamarin Studio IDE offers an adequate coding interface (and one that is preferred if working with a team of developers using Macs and Windows computers), Xamarin's IDE has a long way to go before it can surpass the polish of the Visual Studio environment. One the other hand, if you're developing Xamarin Android applications on a Mac, there's no integration (and probably never will be) with Apple's Xcode environment. As such, the Xamarin Studio IDE is where you'll spend your time when developing Mono-based applications for either iOS or Android applications.

Unlike iOS Mono applications, Xamarin Android programs can have the Mono runtime library either shared or statically linked into your applications. If you're planning on deploying several Xamarin Android apps to the same device (say a sales automation mobile suite in a controlled corporate environment), it makes sense to install the runtime separately. But if the application is going to be sold as a standalone item in the Google Play store, statically linking the runtime is the best way to go. Of course, this will add considerable bulk to your Android application.

Mac Development

All Together Now

The Xamarin 2.0 development experience had the same impact on me as seeing Visual Studio bring Visual Basic, Visual C++ and .NET development all under the same roof. It's an empowering feeling to find that you can use the years of C# coding skills to create native applications on the two most popular mobile operating system platforms today. Windows developers who have amassed a collection of powerful Visual Studio plug-ins have the added bonus of using that investment toward mobile application development. While it does take some forethought to abstract the presentation layer elements from the code, doing so goes a long way toward reuse when developing cross-platform Xamarin Android, iOS or Mac applications. While I'd still like to see Xamarin tackle the immensely challenging problem of creating a GUI builder that can generate code targeting native widgets for all platforms, smart use of programmatic instantiation of GUI elements is one way to maneuver around this limitation.

Component Store

One important aspect of this release is the availability of Xamarin's Component Store (Figure 5). Recognizing how many of their customers were reinventing the wheel for data and visual element interactions, Xamarin now offers developers the ability to not only download curated libraries and packages that the company has vetted for quality, but also participate in and perhaps even making a little money at Xamarin component development.

Figure 5: The Xamarin Component Store.

While the store has somewhat limited inventory at the moment, the components they do have (both free and commercial) are surprisingly good. Some even have links to the source code in case your particular programming itch needs a little more scratching. There are also some useful components that Xamarin will no doubt be including as part of their base product in future releases. A few of my favorite free Xamarin components are Xamarin.Mobile, James Newton-King's Json.NET, and Redth's ZXing.Net.Mobile. And speaking of the ZXing.Net.Mobile component (that works on iOS, Android, and Windows Phone), take a look at how easy it is to implement barcode scanning (1D, 2D, QRcode, and so on in either landscape or portrait orientation) in a Xamarin application:

Compare these four lines of code with the arduous task of not only writing your own barcode library for iOS or Android, and then writing the Objective-C or Java code to call upon that library. In my mind, there's no comparison.

Conclusion

Xamarin 2.0 is a very good product, especially valuable to C# developers. The speed and agility gained by using the collection of technologies that Xamarin has bundled into this release is stunning. In addition, the Xamarin components market is a good move and one that will surely gain traction over time. (We may even see component offerings from big name vendors like Infragistics and Component One in Xamarin's marketplace one day.) Even less glamorous but important areas of the product such as documentation, installation, configuration are considerably improved from their earlier standalone products. Xamarin 2.0 has brought together a powerful platform that has considerable market potential as they lead the way in cross-platform development in the post-PC era.

Mike Riley is a blogger for Dr. Dobb's and has been a judge for the Jolt Awards for more than 15 years.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!