Mobile Development with C# is yet another book that I was motivated to purchase by one of O’Reilly’s free webcasts. The title, Cross-Platform Mobile Development with C#, grabbed my attention, and the presentation itself was one of the most impressive I have seen from O’Reilly’s or any other series. The webcast is no longer available in its original format, but it is available on YouTube, and I have uploaded the companion slideshow here since it does not appear to be available on the author’s site. Greg Shackles is emphatic about the fact that he is neither employed nor compensated by Xamarin, the developers of MonoTouch and Mono for Android, which are the tools at the heart of the Cross-Platform Mobile Development strategy – but his proponence of these products is so effective that I hope they at least buy him a craft beer at some point!（＾_－) The book advocates a technique of developing native user interfaces for iOS, Android and Windows Phone 7, adhering to each platform’s idioms, yet binding each to a common C# codebase – a codebase which could also be leveraged by other .NET-based apps e.g. ASP.NET or even Windows 8 Windows Store apps. It then walks the reader through the development of a series of applications, each sharing common underpinnings while binding to native UIs, and with each building on the techniques and/or code of the previous for the most part.
What I hoped to get out of this book, and what I think it is most appropriate for, is ascertaining a strategy for facilitating ongoing development of mobile apps across multiple platforms. What I would not recommend it as, yet it somewhat claims to be, is an introduction to mobile development on the three platforms for C# developers. While it does start out with basic “Hello World”-type applications for each OS, the pace becomes fairly rapid from there, and the dependency between layers once the code sharing techniques come into play can lead to some rather difficult debugging scenarios, which I cannot see someone without a sure footing in iOS and Android development concepts extricating themselves from easily. It may be that I prefer to manually re-enter code examples – vs. simply downloading and running them – leaving myself open to such encounters – but I encountered some fairly obtuse error messages along the way – some caused by simple typos or autocompletion mistakes, but others caused by mistakes in the book, or variances in versions of the requisite tools. Things can certainly get confusing as you switch between PC and Mac, MonoDevelop and Visual Studio, platform-specific shared libraries and the shared library that each links to, and the platform-specific apps atop that. In addition, the book requires recollection and comprehension of previous chapters’ techniques, often providing only partial code listings, and making frequent “go ahead and do X in the same fashion as was done in Chapter N”-type statements – trivial to the experienced NIB-wrangler perhaps, but far from the step-by-step walkthrough that a mobile development newbie might require.
The example projects demonstrate the use of interfaces to abstract each platform’s implementation details from a shared layer of business logic, the observer pattern via events, per-platform partial classes, conditional compilation, platform-ubiquitous namespaces (thanks to the Mono Framework) and common .NET framework features (e.g. LINQ) over a range of applications. Common networking functionality is leveraged to build a Twitter client, file system and database differences are explored via a note-taking app, and diverse location facilities are unified via a mapping application. The author provides an excellent level of detail on the similarities and disparities between the three platforms, the related opportunities and caveats, and a logical project-based trajectory. The conclusion seemed somewhat jarring, though Appendix B provides a list of books and online resources for further C#-based development on each platform. Overall, the book was a logical extension of the superb presentation that led me to it in the first place, and provided a wealth of ideas and insight which I look forward to applying to current and future mobile app development.
Mobile Development with C#: Building Native iOS, Android, and Windows Phone Applications
By Greg Shackles
Publisher: O’Reilly Media
Released: May 2012
Print ISBN: 978-1-4493-2023-2
eBook ISBN: 978-1-4493-2022-5