In this series, I discuss memory management issues you can run into while developing cross-platform apps using the Xamarin (now Microsoft) frameworks.
NOTE: This series is based on a presentation I presented at a local Xamarin Developers group in September, 2013. I pointed out problems that will cause substantial memory leaks in Xamarin-powered apps (particularly on the iOS platform) if they aren’t addressed by the practices I recommend. Some, but not all, of these problems were due to a lack of mentioning the practices in Xamarin’s documentation, and Xamarin’s “best practice” sample apps not implementing them. Xamarin has improved both their documentation and sample apps since that time, but you still should also implement these practices to avoid encountering the problems when building great cross-platform mobile apps with Xamarin.
So yes, I really do HEART Xamarin, and its very much a “love at first sight” story. How did I get here?
I was at a technology crossroads in the summer of 2012. I had been involved in multiple high-profile projects using Adobe Flex since 2006, but the writing was now on the wall regarding its future in the enterprise. Flex was on its way to being out of favor.
I evaluated the tech landscape with an eye towards balancing my daily joy of working with the language and supporting tools, and maintaining or improving my income. I concluded that developing iOS apps with Objective-C was the sweet spot between the two for me. I jumped into an online course offered by Stanford University and picked up some “learn by doing” books from raywenderlich.com.
I completed the work with those resources in February, 2013, but then an odd thing happened. First, there was a developer friend that I worked with on a Flex project a few years earlier. He had subsequently launched his own VC-funded company that needed mobile apps. He posted on Facebook that he and his team had completed the Android version of their product and were starting work on the iOS version. “Great,” I thought, “this is perfect timing! I need to reach out to him to see if I can join the team.”
I assumed he had developed the Android version in Java, using the Google-provided tool set, and would be starting basically from scratch with Xcode and Objective-C. “No,” he said, “I’m using Mono to create both platform versions and love it! I don’t need any help.” I was puzzled—the only “Mono” I recalled was from the early 2000s, when an open source project to implement Microsoft’s C# and .net framework on Linux was announced. I needed to look into this “mono for mobile” thing.
Two days later, another long-time friend and customer called to ask if I had heard of something called Xamarin. He said it claimed to allow writing your app once using C# to build native apps for iOS and Android. I shared my initial thought with him, which was “it sounds like one of those lowest-common-denominator solutions that don’t work very well on any of the platforms, but I will look into it.”
That weekend, I Googled “Mono” and “Xamarin” separately and discovered they were actually one and the same. I reviewed their developer documentation and found that they were very transparent and open about their approach. They provided a lot of sample Xamarin apps that had been ported from Apple- and Google-provided samples, which made it clear that this wasn’t a lowest-common-denominator approach by any means. Best of all, the C# versions were a whole lot easier on my eyes than the Objective-C equivalents, what with all of those square brackets everywhere!
After exploring their site all weekend, I couldn’t believe that I had never heard of them. Where had they been hiding? It didn’t matter. This was the direction I was going to go.
And it was good timing! Xamarin had just shipped a greatly-improved Xamarin Studio IDE and other improvements that existing Xamarin developers were really excited about. Less than a month later, Xamarin announced that Evolve, their first-ever global developer conference, would be held in Austin, Texas. I immediately signed up for the full five day event. It consisted of 3 days of intense training and 2 days of sessions and exhibits. I had drank the Xamarin Koolaid and was hooked!
A couple of months after the Evolve conference, Xamarin made their first certification exam available to the 400 developers who had completed the Evolve training course. I don’t know how many developers passed but, with a 97% score on the 100 question exam, I was proudly among the world’s first certified Xamarin Mobile Developers!
Coming Up…
In the next part of this series, I describe the iOS version of the first app that I developed using Xamarin, and what I found when I profiled it as a final step before submitting it to the App Store. I hope you’ll come back for the rest of the story, or subscribe so it will be immediately delivered to your inbox when it is available!
Leave a Reply