Objective-C is confusing | Rickard Andersson

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.


  1. satta
    Posted January 27, 2010 at 11:53 | Permalink

    hey mate, how did the progressive C development go? i’m thinking of getting into it, if i can integrate it into my visual studio but was it hard to get over?

    the syntax you posted looked pretty weird considering its supposed to be like C or C#!


  2. Posted March 3, 2010 at 15:39 | Permalink

    Why is it a mess? Syntax is totally arbitrary. Lots of people love this bracketed stuff. I am not one of them, yet, but syntax is just syntax. Reference counting, on the other hand, requires work and is a huge hassle. But apparently that’s necessary to keep it light (doubt it, though).

  3. Posted March 3, 2010 at 16:01 | Permalink

    Well, I guess it’s only a mess if you’re used to something different. Reference counting is indeed a hassle. I almost prefer old-fashioned malloc/free.

Post a Comment

Comments are moderated. Your email is never published nor shared.