Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: currency converter tutorial and "self"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: currency converter tutorial and "self"



On 10.12.2009, at 20:16, Patrick J. Collins wrote:

> Thanks for the replies..  I think that makes more sense to me now.
>
> The other thing I was wondering about is, the tutorial did not handle memory
> management and said to turn on garbage collection...
Which is a real good idea.

>  I am trying to learn to
> code without garbage collection,
Why? You just add another concept to learn, which many have problems with (although it *is* quite easy). And GC is the thing of the future, retain/release the past. Proof? Xcode uses GC, and since it does so, it became a lot more stable. I’d say this proves that GC is ready for prime time.
In the case you are forced later to use retain/release (working with old code, Tiger compatibility, iPhone development), it is still time to learn it then - after understanding how Cocoa works.

> so I ignored that step and did:
>
> 	converter = [[[Converter alloc] init] autorelease];
>
> 	instead of what their code had:
>
> 	converter = [[Converter alloc] init];
>
> ...  I am wondering, is that the best way to do it?  I know there are other
> ways like to actually do [converter release], but I was unsure when to do that,
> and also I know there is a dealloc method you can call?  or is that
> automatically called when it's released and the retain count is 0?

There’s comprehensive documentation by Apple about retain/release rules. If you really want to learn this now, read this documentation. And read it again until you really understand it. Guessing won’t work.

>
> Anyway, I was hoping someone could give me some insight into what some of the
> other ways would look like and their pros/cons.

Best
Kai

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >currency converter tutorial and "self" (From: "Patrick J. Collins" <email@hidden>)
 >Re: currency converter tutorial and "self" (From: "Patrick J. Collins" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.