Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objective-C 2.0 style question.



I have a question.

I am getting ready to teach a bit on Objective-C 2.0 to colleagues and I have a bit of a style question.

If i have the following defined:

@interface foo : NSObject
{
@private
NSString* myString;
}

@property(copy) myString;

-(void)displayString;


@end

Which way is better to use myString in the displayString function? Is it better to do self.myString or use myString directly. 

Comming from a C++ part of me says to always use the acessors if defined (unless private and not exposed), also using the accessors allows us to make sure our bindings are updated if its a bound value, but i see a mix of code and it may depend on if the iVar is to be exposed or not.. The company i work for is now getting into iPhone and 10.5 development and i want to stress the proper design choices.

Scott
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.