With smartphones and tablets rapidly becoming the most common computing devices in our lives, you’re likely to want to start building your own mobile apps. You could start with the web: HTML5 applications work well on mobile devices, especially when wrapped as standalone apps using tools like WebWorks and PhoneGap. But for real power you’re going to need to build a native app, one that can take advantage of the speed and capabilities of today’s devices.
That’s where the dilemma comes in. Do you want to build iOS apps in Objective C, Android apps in Java, or Windows Phone apps in C++? All have their idiosyncrasies, and their learning curves – and that means code you develop for desktop applications will be tricky to port. That’s all very well for large development teams, but how does the solo developer support the largest number of users and devices as possible? While write-once, run-anywhere is an impossible dream, what you really need is a single development language and environment with support for each mobile platform’s native features.
That’s where Xamarin comes in, with its Xamarin 2.0 toolset. Built around Microsoft’s C# language, it uses Xamarin’s open source Mono framework to deliver C# applications on iOS, Mac,use and Android as well as Windows. Unlike other cross-platform frameworks Mono doesn’t assume you’ll be using the same user interface components on each device. Instead Xamarin 2.0 is focused on letting you support core code and business logic across platforms, and then building a native user experience on top of your code. Think of it as build once, customize many times.
C# is a popular language, even though it’s focused on Microsoft’s .NET platform. Coming from a heritage that goes back through Delphi to Turbo Pascal, it’s designed for rapid application development – and for apps that work with remote web services. It’s also easy to learn, with syntax that’s familiar to developers coming from raw metal languages like C++, from interpreted code like Java, and from scripting languages like Perl and Python. It’s been my go to language for application development since the early days of .NET, and recently added language features make it well suited for mobile apps that need to communicate asynchronously with remote web services.
We spoke to Xamarin co-founder and CTO Miguel de Icaza about the latest version of the company’s tools and how users were taking advantage of it. De Icaza described the Xamarin strategy simply: “We’re bringing C# to mobile and to Mac”. He went on to give more detail, “We’re supporting native experiences on different devices, taking advantage of their UI models and integrating with their operating systems”.
Talking about code-sharing between apps, de Icaza told us that game developers can just write code once. “MonoGame will have the same UI on all platforms.”
However, things are different for developers working on apps that need native UIs. “Codesharing will vary from 100% of an app to just what you need for what you’re doing. You’ll be able to deliver specific code for specific platforms”.
One example of this is TouchDraw, an app for creating business graphics and diagrams. The iPad version is 61% common code, with the Mac using 76%, and Android 72%. The developers could use the core code and then take advantage of native graphics libraries and tools to build the UI – so the iPad version could use touch controls, while the Mac version is for mouse and touchpad use.
Xamarin has used this release to develop its own IDE.
De Icaza told us, “We’re replacing the older, open source IDE with something that’s a lot cleaner – for example it’s taken three search systems to one unified search.” A new IDE isn’t the only new feature in the platform, and Xamarin now includes its own component store to help speed up application development, with forty or so components in place at launch. Getting a component library in place was important, as de Icaza noted, “Developers may not be mobile experts from day one. So we’ve also provided templates and themes to speed up development.”
The result is a platform that makes it easy to make apps look good, with skins just needing a line of code to deploy. De Icaza says “It’s all about empowering developers to create great applications”.
Getting started with Xamarin and Mono is easy enough. The Xamarin 2.0 IDE is a free download for independent and hobbyist developers (though it can’t be used for enterprise application development). It installs all the prerequisites for Android and iOS development, simplifying what can be a complex process, leaving you with a simple, clean IDE – and if you’re paying for one of the higher tiers of support, with Visual Studio integration. You’ll also need to switch to a higher tier if your apps get too large
The Xamarin IDE comes with prebuilt apps to help you get started. These include a field service app and an employee directory – and if you don’t want to download the apps they’re available on Github, so you can see the code and get ideas for how to build your own apps. There’s a lot here for developers to work with, starting small with the free edition and working their way up to the full enterprise edition. It’s an interesting model, as it means you can work with Xamarin at home, trying out ideas, before bringing the code into the office and into a copy of Xamarin that lets you deploy to enterprise users.
With companies like Rdio building apps on Xamarin the company is gaining a roster of significant case studies. Rdio has used the tools to simplify its development. It can now use just set of core functions, and build a custom UI for each target platform.
There’s a lot to like in the new Xamarin tools. They contain the features you need to get started with mobile development, letting you use one familiar language to target everything from Windows Phone to iOS and Android tablets to Mac desktops. A freshly designed IDE is just the icing on the cake.