This will be a more casual post, but I think it’s an extremely important one nonetheless. I’ll begin by discussing our companies experience with Xamarin.
As a company, we adopted Xamarin about a year and a half to two years ago, and we’re by no means masters of Xamarin, so take what I say with a grain of salt. We decided to give it a try when a client approached us and they wanted a pretty simple app, it needed to support iOS and Android, it needed to support three different languages, and it needed to have some static pages with translations pulled from a database, not too hard so we gave Xamarin a shot, and we were able to pump it out on both platforms in about two months of working off and on (we’re consultants so we don’t typically devote a full day to any one client). Since then, we’ve done three other projects using Xamarin, the latter two being rather complex.
So what were my impressions? Well…it’s a toss up in several ways. To fully explain how I feel about it, let’s discuss Xamarin as separate components.
This can be summed up in one word, hell. I have never fought so hard, with so many problems, to get a piece of software installed and working properly, my machine had a bunch of issues with Hyper-V, which meant no Visual Studio emulators, so I had to get Google Emulators (which I like just fine), install HAXM, disable hyper-v, setup the JDK, setup Android SDK’s, setup the project settings, reinstall Xamarin several times because portions of the install would get botched, emulators wouldn’t work right, and that was just for Android. In total, it took a full work week to get all the issues worked through, probably 3 days if I had just given up on trying to run the emulators via Hyper-V from the beginning.
I know this sounds dramatic, like I just don’t know what I’m doing, but I did a write up on overcoming various Xamarin install issues and I can’t tell you how many people would tell me that it fixed their issues or helped them immensely with their installs. Now to be fair, when I did a fresh Visual Studio 2017 install on my new box and did a fresh Xamarin download, the process was much, much simpler, I didn’t have to do nearly as many things to get it going, maybe that’s because I had done it 5 or 6 times prior on separate machines, or maybe Microsoft got it together, either way, it does appear to be easier at this point, but still far more complicated than I would have hoped for.
This is a promise that Xamarin made from the beginning, that there was so much shared code between projects that you would’t have to re-write if you use Xamarin via their PCL projects. So do they live up to their promise? Well…I really want to say they do…but there’s just fundamental differences between iOS and Android, so when you do native Xamarin Android/iOS, there’s just not a ton of reuse to be gained. That said, there is code reuse to be had for other things, math for games/algorithms, api calls to a server, shared data, this can all be done in a PCL depending on how you architect your codebase, but if you think you’re going to load up Xamarin (non-forms), and write 100 lines of platform specific code and the rest be shared code, you’re going to be sorely disappointed.
Speaking of code resuse…
If you use .Net for web apis, and you have a website you wrote with asp.net, then good news, integration with your apps will be cake. That’s not sarcasm, the ability to write your apps, webapi, and website all in one development environment in the same language is absolutely awesome, and I legitimately love that this is possible with Xamarin. I would almost argue this alone is a good enough reason for me to use Xamarin.
Unless you’re writing a game or a massively performance heavy app that utilizes crazy front end features, this is a non-issue, all of our apps run just fine, the only time Xamarin was cripplingly slow was when I tried various game development sdks. That’s all I have to say on this really, if your app needs to be performant and it’s going to be a CPU and GPU hog, go native, otherwise Xamarin will do just fine.
From using the Xamarin tooling long enough, I created a metric by which you can tell if your tools you’re using are good or not. Basically, the more often that clean/rebuild and deleting obj and bin folders works, the worse your tooling is. Needless to say, I can’t tell you how many times Xamarin’s emulators would just stop working, clean/rebuild fixed build issues, how many times I’ve hit start emulator literally ten times before it would actually run a build, and that’s just to get the app running, don’t get me started on the debugger, almost all of the native properties you need to look at are either buried in their native runtime object equal, or evaluation times out so you can’t really see what’s going on. That said, I think the Visual Studio debugger is a world class, top tier debugger, for Xamarin though…not nearly as good as a native debugger from the standpoint of ease of viewing raw data.
The profiler that Xamarin created is pretty useless as well, it basically doesn’t really do anything, you can get very topical data on how performant the app is, you can view your heap size, a few other things, but it seems to only profile the Mono runtime, which really isn’t all that useful. Again, I realize this is a massively hard problem they are trying to solve, but that doesn’t excuse bad tooling. Another thing is the emulators just scale horribly and they don’t at all give you an accurate representation of what your app looks like, if you’re used to say, the Android Studio emulators for Mac, don’t expect anything close to that quality. Speaking of Apple, the iOS simulator for Windows is just…words cannot describe how bad this thing is, I don’t know where to begin, just try using it, you’ll see for yourself.
The designer windows, both for Android and iOS, are absolute trash, I do all of my layout code for Android in xml, and all of my iOS UI programatically in viewcontrollers (that’s also because I don’t like storyboards and think they make things way more complex than needed, but that’s just my opinion). The problem with the Android designer is the second you use a custom style, or load a fragment, the layout becomes totally inaccurate in every way possible, and the iOS storyboard is as slow as anything you’ve ever seen, and that’s assuming you can even get it open, half the time it fails to open.
This has been a big problem for me personally. Xamarin is a wrapper around native stuff (pretty sure that’s how they describe it in their very technical documentation), because of this, any native API has to be wrapped to work with Xamarin (well…it doesn’t HAVE to be but…give using native stuff a shot, have fun), this means if you need to support something that is supported natively, and it’s not available as a Nuget package…looks like you’ll be wrapping that Api yourself or finding another one, simple as that. In Xamarin’s defense, they are good about keeping the big Apis that matter up to date, AppCompat, stuff like that, they suck at the less used ones (see my Dropbox v2 support blog post for more info on this).
We’re literally the only Xamarin shop I know of in the entire city, and we know a lot of developers. Xamarin is still small, which is exciting because it means we’re getting in on something early that will likely be a big contender in the app development marketplace, but it also isn’t so good, because there’s not much support out there. Very often, the implementation of something from Java to C# can be confusing at best, methods in Android become properties in Xamarin, interfaces you declare inline in Java are created as separate files are implemented as interfaces in C#, some stuff just flat out isn’t in Xamarin Android, or behaves different, etc. All this to say, prepare to spend some time figuring stuff out (or follow my blog for daily posts with useful tips on Xamarin topics).
Overall, I think that Xamarin still has a long way to go, probably another five – ten years before it’s mature enough to be a real contender in the marketplace. This isn’t me trying to value the stuff I use everyday, I’ll drop a technology in a second if it ends up being a bad technology with no potential, but I truly think that if Microsoft invests the money, that Xamarin is going to be a powerful player one day, and if you get on the ship now, I really do think it’s going to pay off big time.
My overall opinion
So the big question, do I think Xamarin is worth it for now? If you love .Net, absolutely. If you are already doing native iOS and Android…honestly you probably don’t stand to gain a whole lot. In terms of where I see Xamarin in five or ten years, I think it’s going to be a great technology to learn that will be every bit as marketable as native mobile app development, for now if you’re really serious about app development, I would seriously consider learning both native platforms, and Xamarin, that’s going to give you a serious edge in the market. Hope this helped you out, and again, we’re still pretty new to Xamarin, so take everything I say with a grain of salt. Thanks for reading, and feel free to contact me or comment with any feedback.