Book Review: iOS Programming for .NET Developers

A couple of weeks ago Josh Smith published his latest book, "iOS Programming for .NET Developers", which seeks to ease the transition from .NET to iOS developers. As someone who has many years of .NET experience, and more recently a desire to develop for 'the other side', I thought this might be the book for me ...

Colin Eberhardt is CIO at ShinobiControls, suppliers of highly interactive and fun charts, grid and UI controls for iOS developers.

The technology landscape feels like it is moving faster day-by-day. Tablets and smartphones are becoming ubiquitous, usage of HTML5 is on the rise, whilst Silverlight is unfortunately in decline. The .NET technologies are still a solid foundation for desktop and server-side development, but to deliver cutting edge user-interfaces, you need to add other technologies into the mix. I've said it before, but it bears repeating; now, more than ever, is a time for developers to diversify and learn new skills.

Personally I have invested time in learning HTML5 / JavaScript technologies such as Knockout and GWT, but more recently I have been attracted to iOS through my work with ShinobiControls.

For a seasoned .NET developer the transition to JavaScript-based technologies is relatively painless, you can still develop using Visual Studio on a Windows PC. Furthermore, JavaScript is generally quite readable, having a familiar feel to it. In contrast, iOS development is something of a culture shock. It requires a Mac computer, and worse still; Objective-C looks like absolute gibberish! Josh Smith has written a book specifically for those of us trying to make this transition.

So who is this Josh Smith character? I first came across Josh about 5 years ago when I started learning WPF development. Josh was well known for his depth of knowledge, which earned him an MVP award, and the extensive number of articles he wrote on the subject, including his article on the MVVM pattern that became a standard reference on the subject. A couple of years ago he practically disappeared from the Microsoft scene altogether, re-emerging as iJoshSmith (who I like to think of as his robotic alter-ego). Josh spent the next two years learning the art of iOS development - the book he has written is the one he wished had existed when he started on his own personal journey.

Book Format

Before diving into the text itself, we'll take a quick look at the 'hardware'. This is a self-published book, with electronic versions available for reading on your Kindle, Nook and iPad. You can also purchase a paperback edition via Lulu. Josh sent me a copy of the paperback, but I also purchased the Kindle edition to see how the two compare. Technical books often have more images, figures and code-samples than text, and eBook versions often fail to reproduce this mixed content well.

The Kindle copy of the book is presented very well and the code samples are quite readable, being reproduced as images in order to maintain the required formatting. Zooming is pretty clumsy on a Kindle, however, almost all of the figures in this book are fine at their default size. Also, this is not a reference guide, so is quite suited to the linear reading style that works well on a Kindle.

The paperback is also good quality; although it feels a little large compared to most technology books. On the plus side, you can quite happily sit it open on your desk as you wrestle with your Mac computer!

Part I: Prepare for Landing

The first chapter looks at why you might want to learn iOS in the first place, from my perspective this is quite obvious! The iPhone and iPad are phenomenally popular devices, and whilst the Android has caught up in terms of market share, the iPhone is still the device that most businesses target first when delivering a mobile application.

A brief overview is given of the alternatives, including Hybrid / HTML5 applications, and MonoTouch, which I have played myself recently. Although, again, the case for native is quite compelling, so Josh wasted very few words here!

The next couple of chapters are all about getting used to the environment, starting with the process of joining the iOS Developer Program and finding your way around a Mac computer. There is an entire chapter dedicated to Xcode. Whilst it is not exhaustive, it does show which parts of the Xcode interface are similar to Visual Studio. The slightly alien looking IDE starts to seem almost familiar after reading this section.

Part II: Ways of the World

The next two chapters are where things start to get serious! Chapter 4 handles moving from C# to Objective-C, while Chapter 5 tackles memory management.

The Objective-C language is introduced by drawing comparisons, where possible, to C#. There are frequent code samples, concerning Ninjas and the odd reference to a The Hitchiker's Guide. Fortunately I was a Visual C++ developer at one time in my past, so the concepts of separate header and implementation files, and pointers rather than references made sense to me. In other areas, the comparison to C# works well and I certainly feel like I have started to understand the language. However, there are other areas that I feel could have benefited from a little more detail, for example the section on message passing left me wanting to know more, especially about selectors (when do I need to use this oddity?!). Josh does make it clear that this book is not a comprehensive guide to iOS development, and makes frequent reference to other literature (which is typically online and free).

The chapter on memory management details the technique of reference counting, together with the various keywords that manage this process. After reading this chapter a couple of times I feel like I have a good grasp of how to approach memory management on this platform, although I would like to have seen a worked example of memory being incorrectly managed, followed by a diagnosis via instrumentation, and a 'cure'. Autorelease certainly sounds like an interesting concept, and one that I feel I will need to try for myself to truly appreciate. Josh gives quite a swift overview of Automatic Reference Counting, advising readers to learn how to manage memory manually, advice that I will certainly heed. It is probably all-to-tempting for someone who is used to the Garbage Collector taking the full responsibility for management to reach for something which on the surface of it looks like the iOS equivalent, however it certainly looks like ARC is not a silver-bullet!

The chapters that follow cover the iOS equivalents of the .NET Base Class Library, and how to build user interfaces with Interface Builder. These chapters are all quite easy to follow, demonstrating that iOS has a library of classes, that provide a roughly equivalent set of features to those which we have in the .NET world. The Interface Builder is a tool I have used briefly via MonoTouch, and found it to be very easy to use. These chapters also cover the basic structure of iOS applications and the MVC pattern. These topics are all presented in a concise, yet information rich style.

Part III: Alien Technology

The final few chapters are a mixed-bag, covering other topics that you will most likely encounter during the development of a typical application. There is a good overview of XML, JSON and web services which I must admit I skimmed over - I'll go back to this section when I need it! Needless to say, it looked no more or less complicated than .NET development, and by this point in reading the book I had almost grown used to the Objective-C syntax and naming conventions!

I found the chapter on Core Data very interested. iOS developers have what looks like quite an advanced object-relation mapping API at their disposal, together with tooling for designing entity models. It was also interesting to see the concept of Key-Value coding, which was introduced in an earlier chapter (and compared to .NET reflection) made use of here.

The final two chapters tackle debugging and unit testing. As expected, Xcode has a pretty similar set of tools to Visual Studio, although there are some 'instruments' that related directly to the iOS memory management model.

Summary

iOS Programming for .NET Developers, is a concise, yet information rich guide for .NET developers who are interesting in developing for the iPhone and iPad. What makes this book unique is that it helps you leverage your existing skills in a way that you would find very hard to do by yourself. The similarities between the two environments are far from obvious, but I am happy to say that there are a great many! I feel that reading this book has increased my comprehension of iOS application development far quicker than a standard text on learning iOS would have allowed. This book is also highly sympathetic to the reader who has most likely never used a Mac before, for example, the section on browsing an app's SQLLite database really 'holds your hand' as it leads you through the file system.

I would thoroughly recommend this book to anyone who is starting to learn iOS development. It has certainly helped make the alien landscape feel that little bit more familiar to me.

Regards, Colin E.

MORE BY COLIN

gifbot - Building a GitHub App

blog comments powered by Disqus