Ten months ago at my team we reached that point that I think any mobile developer know about. Is it worth developing native? Should we keep coding the same things two/three times? Master a programming language and a technology is difficult, think about three. Not to mention to try to keep updated with the continuous incoming of frameworks, versions, libraries and components.
This is, of course, something inherent to software development in general, not only mobile. The thing is that even that we daily need to deal with different browsers nonsense in web development, or with multiple OS versions and environments in server/desktop, those are (usually) implementation details. We don’t usually need to re-implement the whole app and maintain separate codebases for Chrome and Firefox.
So, and finishing the self-pity for today, we tested most all the code-one-deploy-all available environments at the time (Cordova, Marmalade Phonegap, Appcelerator…) and we finally decided to give a serious try to Xamarin. The main reasons? We wanted the most native approach, not HTML5 web wrappers, we had lot of experience using C#, and the Mono-.NET framework ecosystem availability was too tempting. (Once you know linq is hard to renounce to it).
Now is time to decide to renew or not the Xamarin subscription and following the internal discussion we are having here, these are my conclusions from a programmer and software architect perspective.
- Xamarin works. During this time we have developed, tested and deployed Android and iOS applications using most of the possible features a mobile app can target, among others:
- Google play and Apple store deployment
- In-house deployment with custom autoupdates
- Push notifications
- Beacons technology and real time signal processing
- Any kind of imaginable UI layout
- PCL development and background code sharing
- Automated testing using Calabash
- Video streaming
- OAuth integration
- Remote REST APIs consuming
- Social media (facebook, twitter) integrations
- Embebbed SQLite
- Phone and tablet deployment
So, our general feeling is that if is possible to do it native is possible (I don’t say easy) to do it using Xamarin.
- The Mono framework integration works. Yes, you really can use C#, linq, Lists, Generics and -most- of your beloved .net stack
- Growing ecosystem. The components library keeps improving and getting more and more useful stuff.
- Growing project and community. I don’t know of course the internal situation of the company, but seems that the Xamarin project is alive and has future. There are continuous developer meetings in cities all around the world and they keep pushing new improvements in the product.
- Microsoft seems to start to seriously support the project.
- Yes, you can make the same things that you make using java or objective c or swift, but when your app needs to go a bit further in terms of UI or interaction, things are not straightforward. We develop very specific and customized boutique apps with intense requirements in terms of design, animation and integrations and when you try to push that forward in Xamarin problems start to appear. (Missing features, compatibility issues, not existing libraries…)
- Xamarin creates his own problems. As a new layer over the native environment you don’t have real control of what is generating as the final code that will be run on the device. There is the case of an iOS objective-c feature we translated to Xamarin, a very specific subclass customization of the UINavigation bar. In theory we were using only standard objective c instructions (like, add this UIView here, push that in the UINavigationController , change this color…) so the translated C# code was the same, line by line. But the Xamarin implementation didn’t work. We never got to know exactly what the problem was, but the order in what the UIViews were drawn was important and we suspect that the code generated by the xamarin compiler wasn’t the same that the one generated using Xcode. We ended implementing a not pretty workaround.
- Following this, xamarin has his own bugs. This is normal, of course, but the point is that you are in fact adding a new source of possible problems to your development process. We had a problem using the HttpClient class that costed us a lot to track as a Mono implementation problem, and not ours. Again, we ended implementing a workaround against the standard use of HttpClient. Similar stories to this one regarding memory leaks, not standard behavior, happened to us very often
- All these required workarounds are something you cannot plan at the beginning of the projects, nor are problems you can expect if you use standard programming guidelines, and keep adding time, cost and effort.
- Logically, the amount of resources, components, libraries and available help is far from the available for java or objective c. Situations like ‘I would use this cool slide menu library but the xamarin bind/port doesn’t exist, or is much older, or it would take a lot to implement’ or ‘this stack overflow thread will help me, wait is for native not for xamarin’ are common.
- Android development is slow. Like painfully slow. Not the development itself, but the process of deploy to the emulator or to the real test device. It takes ages, no matter if you use the standard emulator or the Xamarin Android Player , or a real device. No possible comparison with deploy using Android Studio, specially to real devices.
- Price. This of course depends of your team size, resources and what you can expect to save using Xamarin, but 1000$ developer/year is not exactly cheap.
- You can share background code, business logic… but again, if you want real customization you need to implement the UI yourself. There is part of the business logic that in fact you can copy, but no share, because the specifics of the flow execution in each platform. (As a very simplified sample, you cannot always make a 1:1 relation between Android activities and ios UIViewControllers and that ends with part of code that should be in different places) Even with Mvvmcross (that we have used) is not always possible.
- The solution to even share the UI (Xamarin forms) right now, doesn’t work apart of for simple apps and UI. Of course this is only our experience, maybe we are wrong, but if make something detailed or specific in UI using Monotouch or Mono for android is difficult, with Xamarin forms is simply not possible, and speaking about the code itself, you usually end with a bunch of separate interfaces with different code for each platform.
- Xamarin studio, the development tool if you are using mac or dont have Visual Studio, its still far away of Xcode or Android Studio. It has improving during this time of course, and is usable but it lacks the features of his native counterparts, and continuous crashes and mysterious file disappearances are routine, not to mention the fear of what will crash now after each system update.
- The community (only part of it of course) sometimes takes the defence of Xamarin too serious, and you cannot go against the idea of how is the solution to all the mobile development problems . I mean, is a great tool I enjoy working with, but that’s it. If I found a better solution for a problem, I would use it
So, to sum up, is it Xamarin worth it? For me yes, but as other tool to add to your options, and not to totally replace native development, at least for now. Depending of the project and requirements I would be happy to have Xamarin available and I will use it, but there will be other situations in which I really think use native will be a better choice.