April 2009 Archives

Initializers in Objective-C

|

As I mentioned in a previous post, I was on the Object Oriented Programming episode of the Mac Developer Roundtable. At one point, the discussion turned to the apparent self = [super init] myth and how assigning to self was not needed and should not be done. Here’s a transcript of my response (with a lot of embarrassing “you knows” removed). My actual response can be heard at 54:51 in the podcast:

Yeah, I mean I don’t want to talk about this too much because it really has nothing to do with object oriented programming. But the fact of the matter is init returns a value. And Apple’s documentation says you should assign self to the return value. It’s the rule of the language. It kinda sucks; I wish they didn’t do it, and it’s rarely needed, but that’s how it is. And it’s really not a lot of work to call, to do that, just say “self = [super init]” And I don’t really see any reason not to do it, and I don’t see any reason to recommend people not do to it because it’s the right way.

That’s all I said on the topic mainly because I thought it was off-topic, and others covered the technical details. However, I think it’s an interesting point, so I thought I’d take a moment to elaborate on my response.

Mac Developer Roundtable #17

|

Scotty from the Mac Developer Network just released Mac Developer Roundtable, Episode 17, where I was one of the guests invited to talk about object oriented programming. I always hate listening to myself, especially in podcasts like this where I listen and think “Oh, I should have said …” Anyhow, have a listen, and join MDN. Scotty’s truly one of the nicest people in the Mac community and he’s providing a great service. Be sure to support his efforts.

About this Archive

This page is an archive of entries from April 2009 listed from newest to oldest.

February 2009 is the previous archive.

May 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Links

Powered by Movable Type 4.1