iPhone SDK – Initial Thoughts

I have been following iPhone since its inception. Initially, when Steve Jobs revealed that there was not going to be any developer SDK, I was just one of the millions to be really upset. Then, one fine day the iPhone SDK was released, the now infamous App Store was released, all are happy and the rest is history. I did try out some examples immediately after the SDK was released but then got busy with other interesting stuff (like trying out a startup) and didn’t focus much on it – until recently.

A few months ago, my company picked me to get trained on the iOS SDK. Five days of Objective-C and XCode and Interface Builder later, I was coding for the fifth mobile platform in my career. I initially started with BREW, moved on to J2ME (now Java ME), then Blackberry (includes J2ME), then into the Bold and Beautiful Android and now into iOS.

I cannot help but compare my Android experience with iOS. Coming from a Java background, it should not be a surprise that I will be comfortable with Android SDK than with the iOS SDK. Even when that is the case, I feel that the iOS SDK and its tools is not all that developer friendly compared to Android. Apple has created the best layman products ever but they are quite bad at creating developer products, I guess.

Objective-C as a language is a lot more difficult to master than Java. The complex memory management gymnastics, multiple files to define one class and weird method definition syntax are just a few of my gripes. XCode 3.x is a hell to work with at least from an Eclipse/Netbeans/Idea user perspective. Why should I have to move between two applications called XCode and Interface Builder to develop one iPhone app? Why can’t I develop in Windows or Linux if I want to? Why doesn’t the debugger work well most of the times? Why isn’t Garbage Collection part of the language? Why isn’t incremental compilation available? These are just a few questions that come to my mind when I develop for iOS…

That said there are quite a bit to like about the iOS platform as well. Objective-C has some cool features like id type, protocols, named parameters and categories that I would have loved Java to have. I keep hearing from people that once you deploy an iPhone app in the App Store, the benefit in terms of payback is good enough to justify the pain. Interface Builder is very good at what it does compared to the equivalent Android designer. XCode 4.x vastly improves the development experience by integrating Interface Builder tightly.

Although both iOS and Android are vastly different platforms, they are together ruling the world today. As developers we don’t have a choice other than learning and working with these heavenly beasts until the cross-platform world for mobile (like PhoneGap, Titanium, Rho Mobile etc) matures

Ganeshji Marwaha

I spend my days as the Director of Technology for Mobility practice and help my clients design enterprise and consumer mobile strategies. Mobile Payments, Digital Wallet and Tokenization technologies are my areas of specialization

  • Completely agree with you. Not trying to be a Microsoft fan boy here, but I think Microsoft does seem to be able to put out absolutely great developer tools. Some of the developer focused improvements coming up in the next update for WP7 for instance are quite incredible IMO – especially the emulator simulation for accelerometers and GPS. You can watch a demo of this here: http://channel9.msdn.com/Events/MIX/MIX11/KEY02. The video is a bit long and the demos I mentioned comes an hour or so into the video but it is kind of fun.

  • god

    > Coming from a Java background

    Lamer

  • Just a few thoughts –

    I think Java is the only language that forces one file per class, so I think it’s Java which is odd in this respect. The separation of header and class files comes from C.

    ObjectiveC is very different from Java which is probably why you are struggling. OC is based on the smalltalk language which is message based. Java is method based. That distinction causes most of the problems in switching between the languages. You’d probably have an easier leap to something like C# or another Ada based language. ObjectiveC is also much older than Java, so many of the lessons learned are reflected in Java.

    XCode 3.x does suck greatly. I’d switch to XCode 4.

    Garbage collection is not a part of the iPhone, but does exist in ObjectiveC 2.0 apps for the Mac.

  • Ganeshji Marwaha

    @DJ Spiess – Java does NOT force one file per class at all. So, your only odd point is moot. Also, since I am also from a C background, I understand that header and class files concept. Understanding is one thing, feeling the pain is a totally different thing. I do feel the pain there.

    I agree about the message based semantics of Objective-C and it is neat in a way. There are many more neat language features as I have mentioned in the post itself. My Gripe was not with those. It is with the others I have mentioned like memory management (I understand for Mac Apps GC is built-in, but the post was more about iOS SDK), IDE support etc.

    I also do agree that for someone who is quite adept at Obj-C, these may be a non-issue. But for someone getting into the platform, it is quite a different story.

  • I have followed the same path. You can read about what I have experienced on my blog.

    http://kevsaidwhat.blogspot.com/

    Keep in mind that Objective C was designed to avoid writing a new compiler. It was initially a preprocessor for C thus is uses ‘@’ and ‘[ ]’ in its syntax because C was not using them. It is not the easiest syntax to read or even to remember how to write.

    I am finally getting up to speed on Objective C. The language is OK, named parameters are nice but they miss one of the huge advantages of named parameters – the ability to put the parameters in any order.

    Xcode 4.x is a lot better, be sure to get 4.0.1, than 3.x series to me. Being able to have multiple tabs and not having IB separate from the editor is a big help. I hate it that you have to download 4.6g just to get a patch. If you don’t have 4.0.1 you will not be able to submit to App Store.

    Also remember the iPhone simulator is that, a simulator. Depending on your development Mac it will run a lot faster than an actual iTouch or iPhone. Don’t be mislead by speed until you run things on an actual device.

    As far as devices, you have to provision each and every device you want to test on. Not difficult to do, just another step. For the Android anyone can walk in to your office and get the latest build, for the iPhone you have to provision them first.

    I find I have to do 2 -3 Google searches to find my iOS answers where I generally find my Android answers in the first set of results. I just don’t think in Mac terms I guess so I tend to have to dig to find the correct words to search for.

    Having done a lot of C / C++ development in the past I am familiar with memory management. Objective C is still a bit odd here as it does some memory management for you but you have to guess a bit as to when it will and will not. Some method names help you by letting you know if it will copy something or not, others not so much. Memory crashes are a royal pain. Be sure to set NSZombieEnabled = YES in your Environment Variables section in the Schemes – Arguments dialog to really help in this area.

  • Ganeshji Marwaha

    @Kevin Peck – Thanks. Your tidbits like “NSZombieEnabled = YES” are really useful. I also read through your blog. pretty interesting. You got yourself another subscriber…

  • Thanks for this great article
    Extreme Java

  • You are right without integration with SDK iPhone would be having very less features and I think SDK provided iPhones really a great functionality.