Objective-C is confusing
First of all, sorry for the lack of posts recently. Lets just say I’ve been laying low for a few months. After the wedding, Me and the Mrs went on a very nice honeymoon to California and after that, I’ve been trying to do as little as possible. I’m back at work now though and things are getting back to normal.
A few weeks ago, I bought an iPhone 3G and I love it. I like it so much I’ve decided to learn how to develop applications for it. Coming from a C/C++ background, I figured I would be able to download the SDK, play with it for a few hours and then have a basic grasp of how apps for the iPhone are put together. I have to concede though, that so far, it’s a bit of a blur. My main issue is the fact that it, much like OSX in general, uses Objective-C as opposed to C or C++. This is the first time I’ve come into contact with Objective-C and I find it very confusing. I mean, look at this:
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
For someone who is used to the syntax of C, C++ or even Java and C#, this is a mess. I’m sure there are benefits to this syntax that I have yet to discover, but right now, I’m not seeing them. My other immediate gripe with the SDK is the methodology behind the visual UI editor (Interface Builder). It’s pretty straight-forward regarding dragging and dropping controls, but it took me a while to figure out how to even react to the click of a button. Working in Visual Studio most of the day, I’ve grown accustomed to just selecting a control and then clicking the event I’m interested in (for example, SelectedIndexChanged for a drop-down). This takes me directly to the method stub created by Visual Studio and I can code whatever happens when the selected value of the drop-down changes. I get the feeling that the UI editor in Visual Studio is much more integrated into the development process than it is in Xcode/Interface Builder.
I’m gonna continue to play with the SDK and try to learn some more Objective-C. I’m not really looking forward to it, but who knows, in a couple of weeks, maybe I’ll be an Objective-C zealot!
Edit: One thing Apple definitely has going for them is the fact that Xcode is completely free (it comes with OSX). I have never understood why Microsoft charge for Visual Studio. It’s probably their best software product ever and if it were free, I think even more people would develop software for the Windows platform.