Microsoft is giving a leg up to Windows developers building apps for iOS and Android using C# and Visual Studio, with dev specialist Xamarin.
Xamarin has announced support for Portable Class Library (PCL), a subset of the .NET Framework that works across multiple platforms.
The development was made possible after Microsoft last month released PCL to open source.
Members of MSDN are also getting a financial incentive to experiment with the tools and to bring C# onto the non-Microsoft platforms.
They are being offered a 90-day free trial of Xamarin, rather than the normal 30-day period. There are discounted Xamarin subscriptions, such as Xamarin Business for iOS and Android at $1,399 (down from $1,798), and an online Go Mobile training course will be free for MSDN subscribers who sign up before the end of the year.
Nat Friedman, Xamarin chief executive, said the deal really does put Microsoft’s code on non-Microsoft platforms.
“Microsoft long ago had this idea of PCL as a developer tool to share code between different platforms, but their idea of different platforms in the past was Windows Store, Windows Phone, Silverlight and ASP.NET or something like that," he said. "Now they’ve released the PCL reference assemblies as open source, and we are integrating them into Xamarin so you can share code between Windows, Android and iOS."
How deep is the partnership? Developers may be sceptical, based on history. In 2007 Microsoft announced a partnership with Novell to build Moonlight, an open-source version of the Silverlight browser plug-in, but it was a curiously half-hearted partnership. Friedman says this time it is different.
Friedman is closely associated with that history.
Xamarin was formed when Linux shop Novell abandoned Mono, an open-source project to bring Microsoft’s .NET Framework to Linux. It was founded by Miguel de Icaza, the originator of Mono, and Friedman, who’d worked on Mono from its early days.
“I think it’s enormous. It represents a strategic decision that Microsoft made, that people want to build native apps, they want to reach multiple platforms, and Microsoft is trying to give the developer community what they want,” Friedman said.
If Microsoft is serious about becoming a devices and services company, this is a partnership that makes sense, considering that only a small minority of devices run Windows.
Xamarin’s approach to cross-platform development is distinctive in that it does not include the user interface.
'Write once, run anywhere ... you end up with lowest common denominator apps'
Friedman said: “When people think of cross-platform development they think of 'Write once, run anywhere', things like PhoneGap or Appcelerator. You write your code once, design a single user interface. The challenge with this approach is that you end up with lowest common denominator apps, the UI is mediocre because you have to look the same everywhere, it doesn’t conform to the native platform conventions or take advantage of special features on each device.
“We tell you to separate the user interface from the device-specific layer of the app. The rest of the app is what we call the app logic. It contains your authentication code, your network protocols, your data layer, data synchronisation, any business logic, all of that is shared code. What you don’t share in the Xamarin model is the user interface. You build a native user interface for each platform. You still do it in C# so 100 per cent of your app is written in C#, but you get access to all the native APIs.
“On average our developers are able to share about 75 per cent of their code between devices. The approach is focused on portability without sacrificing the user experience.”
Friedman said that since the release of Xamarin 2.0 in February 2013, which included support for Microsoft’s Visual Studio, the platform as grown rapidly. “This year we’ve more than tripled the number of customers, the company grew from 40 people to over 100 now, revenue has grown strongly.”
Xamarin’s tools are ideal for Microsoft platform developers who want to support smartphones and tablets. They can continue to write in C# and to reuse code written for Windows. Xamarin supports Microsoft’s Azure Mobile Services, which uses cloud services as a back-end for mobile applications. “You will see Xamarin appear as a first-class citizen in the Azure Mobile Services web page,” said Friedman.
The price is substantial though. There is a free edition, but it is not much use with its limit of 64k of compiled code, no Platform Invoke to native libraries, and no support for Visual Studio. The Indie edition costs $299 per platform per developer – so you buy it twice if you want to support both iOS and Android – and also lacks Visual Studio support and other features. The one you want is the Business Edition, at $999.00 per platform.
Xamarin is only sold as a subscription. Friedman says that a permanent licence makes no sense. “With new versions of iOS and Android coming out people have to upgrade anyway. There’s no real benefit to a permanent licence.”
Microsoft’s collaboration with Xamarin is good news for C# developers, but falls short of what would be ideal, which is for full iOS and Android support to be bundled with MSDN, at least in the higher editions. “I agree, I think it would be cool,” said Friedman. “We didn’t quite get there yet.” ®