| How is the most ignorant comment in this thread voted up? First of all, he offers no evidence that memory management in objective-c is resource or effort intensive. He can't, because it's not. This is not hard: -(id)initWithSomeNumber:(NSNumber *)aNumber {
...
someField=[[SomeObject alloc] init];
someOtherField=[aNumber copy]; // or retain, your call.
...
}
-(void)dealloc {
[someField release];
[someOtherField release];
[super dealloc];
}
How is that hard exactly? There are only 4 rules you need to follow for memory management in Objective-C/Cocoa/CocoaTouch:* If you use a convenience method, eg [NSString stringWithFormat:...] you don't own it, so don't release it. * If you use alloc, copy or new, you own it, so release it. * Implement dealloc to release fields you own. * Never invoke dealloc directly. I mean you can be as snarky as you want dude, I write Cocoa apps all day long (as well as web apps and mobile apps) and I can tell you and the original poster, are either idiots or lazy. I'm going to go with lazy. |
I just don't see why laziness should be restricted to users. Developers are lazy too.
You're right that there are only 4 rules (or more or less depending on your formulation), but I don't care. I'd rather take the time to have another martini. Or, y'know, implement features that make my users happy.
And it definitely gets harder when there are more moving parts. You're right that the rules are simple, but the execution of those rules gets more complex as you add more components, more threads, remoting, etc. I never said it was impossible, or up there with Fermat's Last Theorem or anything like that. Just that this is work the computer could be doing for me. I want to be lazy, but Apple won't let me.