Cocoa Days

I’m working my way finally through the Hillegass Cocoa book – but of course my 2nd Edition arrived 4 months ago and I never had the chance to read it and 3rd Edition is out and covers the new XCode so I’m going to be fighting an uphill struggle. I’ll order 3rd Edition after payday.

I find code to be hard. My schedule doesn’t allow for me to be consistent in my approach to learning and so I find myself flailing back and forth, trying to remember the stuff I wrote last time round and spending half my allotted time re-learning. It doesn’t stick much. I’m now convinced I need a mentor to do this who will work through the examples with me, advise me left and right and not get all het up when I’ve had a crap week and didn’t get the chance to sit down and work through examples.

My first problem comes with expectations. If I’m control-dragging connections to the left and right in Interface Builder, I was expecting some code to be generated. Instead I have to manually add these things.

My second problem comes with pre-generated code. It added in an import for UIKit/UIKit.h for some reason – and then when I hit Compile, it burped and complained about UIKit. Claimed it couldn’t find it. To which I say “Well, don’t frigging look at me, you put it in there????” This sort of thing frustrates me -especially when I realise it compiles fine when I change that to Cocoa/Cocoa.h.


This error has nothing to do with using the 2nd Edition book. It’s a subclass of NSObject which comes with the UIKit.h reference which XCode subsequently has a kitten about. That’s just stupid. So either there’s something wrong with my XCode (entirely possible) or I’m just the worst coder in the world.

I’d say it’s even odds.

[And the result is in. I’m the worst programmer in the world. I’d added a Cocoa Touch NSObject subclass to my Mac application. Cocoa Touch has UIKit.h. Cocoa has Cocoa.h. I feel stupid now but I have to chalk it up to some sort of learning experience.]

0 thoughts on “Cocoa Days”

  1. Aw, don’t be too hard on yourself. At least you’re giving a go at *real* programming. I gave up after less than five attempts to type in BASIC code from magazines back in the 1980s. Nothing. Ever. Worked.

    Of course, a few months later the mags would print corrections to the code, admitting it didn’t work because *they* screwed up. That didn’t help me, though! I’d already been thoroughly discouraged.

  2. I had the same experience with programming in the 80s using the Sinclair ZX Spectrum. With no way to save the program, it was spend an hour or two typing it in and then it didn’t work. And then discovering next month that the code was wrong. Sod that for a game of soldiers.

    I really want to learn but I’m getting old and grumpy. And there’s always an excuse.

    Tonight I wrote a random number generator. The homework for next week is twofold.

    1) tart it up so it looks good
    2) attempt to port it to the iPhone.

    I think both will be easily done. I’ve not done any iPhone development yet so that will be a challenge in itself. Have to wait and see.

  3. “With no way to save the program”…

    What, you didn’t own a tape recorder?

    “And then discovering next month that the code was wrong.”

    Consider it an exercise in debugging. 😉

  4. I just remembered: COMAL! That was sooo easy to use, I was able to actually create two working things:

    1) A grid on the screen

    2) A scrolling message in big letters

    But I lack the programmer’s gene, I think. Besides, I’d get really discouraged reading articles in magazines about how frikkin *neurosurgeons* would have the time to pick up a programming language and knock off a niche app over a weekend. Bloody sods.

  5. I used to be a Genetic Engineer. My Honours dissertation was bioinformatics (population genetics). But yeah, picking up the O’Reilly Bioinformatics book was depressing (years later) when they just expected me to ‘pick up’ perl….

    Slow and steady does it.

Leave a Reply