April 2009 Archives
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
initreturns a value. And Apple’s documentation says you should assignselfto 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.
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.
