Reflecting on my first iPhone app as a Rubyist: Antenna Mate

Now that Antenna Mate is available on the App Store, I’d like to reflect on my experience developing an iPhone application from the perspective of a Ruby on Rails developer.

Antenna Mate was designed and developed over three months in-between finishing uni and starting full-time work. I was introduced to Objective-C/GNUStep at uni in Programming II. It provided me with the foundation of compilation, pointers, syntax, memory management, and the standard library.

My understanding of the MVC paradigm is Rails’ implementation of MVC. After I started fleshing out Antenna Mate with Objective-C/Cocoa it became obvious that I needed to learn a different implementation of MVC. This was the biggest hurdle coming into Objective-C/Cocoa from Ruby on Rails. Controllers in Rails are thin, maintain minimal state and know nothing about the view. Controllers in Objective-C/Cocoa are larger, maintain more state and respond to events that occur in the view. They’re better thought of as view controllers that manage stateful views.

Objective-C and Ruby share similarities. Firstly, they’re both dynamically typed languages which use message passing. Unlike Ruby, Objective-C allows you to be explicit about the type you’re expecting which greatly improves debugging and code completion in Xcode. Secondly, you can extend classes in Objective-C using categories. A category is the equivalent of reopening a class in Ruby with the exception of not being able to add additional instance variables. Thirdly, introspection in Objective-C is as powerful as Ruby. You can ask an object if it responds to a method, is a kind of class and get a list of instance variables.

Many introductory Objective-C/Cocoa developers complain about reference counting. Referencing counting is straight-forward and when you follow the Cocoa conventions you know when to retain or release an object. The bigger issues are verbosity and plumbing. In comparison to Ruby on Rails, Objective-C/Cocoa makes you feel like you’re writing a lot of repetitive code to connect objects together. Objective-C 2.0 is a welcome improvement to the language, but it’s impossible to write code as elegantly or as tersely as Ruby.

Like Rails, Cocoa is a fully featured and mature framework that provides you with almost everything you need. Built-in views are highly reusable, the Core Location, Core Animation and Core Data frameworks are well thought out and provide you with enough flexibility to use in a variety of different applications. Animations are easy, almost too easy. It’s insane how little code you need to write to smoothly rotate an indicator on the display. When you combine that with Xcode, Interface Builder, Instruments and iOS Simulator you get the benefit of an integrated toolset for writing code, debugging, inspecting and testing your app. As a TextMate user, Xcode feels big and clunky but it’s the best supported tool for developing in Objective-C/Cocoa.

Custom graphics can take more time than writing code. You need to design and test your graphics on the actual devices. The iPhone 4 has a dense display capable of showing great detail where the iPhone 3GS cannot. Laying out graphics on your computer display is very different from using it on the device. If you care about a good experience for your users, you should get your hands on each of the devices that your app will be available on. It’s like testing a website in different browsers. You need to balance maintenance effort with consistency across devices. In addition, don’t expect to be able to alway resize rasterised graphics from @2x resolution to @1x resolution. If the graphic is too detailed, you’ll need to recreate the graphic at @1x with less detail.

Finally, when it comes time to submit your app to the App Store, you should read all the documentation Apple provides. If you’re intending to sell apps in Australia, you must be registered for GST irrespective of your GST turnover. As income on the side, my accountant recommended reporting annually on a cash basis. You’ll also need to complete a tax declaration for the IRS (US equivalent of ATO). Antenna Mate was submitted to the App Store on the 30/Dec and ready for sale on 04/Jan. It was under review for about 6 hours and is only available on the Australian App Store. If you’ve thought about all the use cases (Eg: Core Location turned off for Core Location dependent app) and comply with the App Store guidelines then there is no reason why your app should be refused.

Developing for the iPhone has been a rewarding experience. Apple provides fantastic technical documentation and Stack Overflow has numerous examples and tips for keeping you on the right path. The response from Antenna Mate users has been overwhelmingly positive and is generating revenue. It feels great when people shoot me an e-mail or private message to thank me for creating Antenna Mate.

Written by Tate Johnson on 8 Jan 2011. Subscribe to my blog's RSS feed.