3 ms·
This is a great write up on the experience! Truly inspirational. I especially like the following quote: It truly is amazing how much practice helps. Every tim
by bgraves 16y ago
This is a great write up on the experience! Truly inspirational.
I especially like the following quote:
It truly is amazing how much practice helps. Every time I write a new program, I run into a ton of unforeseen problems and bugs. While frustrating at the time, I usually plan around them the next time I program. This makes me feel like I’m in my very own while loop:
while (stillPrettyBadAtProgramming) {
programmingPracticeTime++;
Program *newProgram = [Program programWithType:ProgramTypeGame];
if (
newProgram.isReallyGood == YES && programmingPracticeTime >= A_HUGE_AMOUNT
){
stillPrettyBadAtProgramming = NO;
}
}
- wblackall 16y agoGlad you liked that. It was fun to write.
- fbu 16y agoIsn't there a huge memory leak? Creating a new pointer on each iteration without keeping track of them. I might be wrong I've been doing games in CL for some time now.
- teaspoon 16y agoWith a few exceptions, pointers returned by methods in Objective-C are assumed to be autoreleased. That means their reference count will be decremented at the end of the event loop. But if OP is expecting a lifetime of learning, he might want to push a new autorelease pool for each iteration.
- mbenjaminsmith 16y agoOr just release it. If you're sure it's autoreleased then retain/release it. If you're not sure, just set it to autorelease before you retain/release it.
- othermaciej 16y agoretain/release on an autoreleased object won't make it get destroyed any faster. You still have to wait for the event loop to cycle (or push/pop your own autorelease pool).
- mbenjaminsmith 16y agoThat's correct. That's something I read, have repeated but never bothered to actually test.
- muhfuhkuh 16y agoAssuming that's in his init method, he left -(void) dealloc { self.newProgram = nil; } as an exercise for the reader.