Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-17-2009, 01:58 PM   #7 (permalink)
BrianSlick
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,978
BrianSlick has a spectacular aura about
Default

Quote:
Originally Posted by benoitr007 View Post
Hmm... If I may ask, what's the advantage of using the getter accessor? I can see for the setter one, but doesn't the getter do exactly the same as just writing enemiesArray? In what cases could it not be harmless to do so?
Yeah, that's what I mean by harmless. Since you're just reading, there probably isn't any difference between using the standard getter and reading the instance variable. From a consistency standpoint, I make it a point to use self everywhere.

However, if you would have a reason to write your own custom getter like the one I mentioned, then there would be a difference, and I imagine that would be a tough bug to track down.

Using [self ...] helps to reinforce that you are using a method. If the implementation of that method would change, that shouldn't affect the code you've already written.
__________________
BriTer Ideas LLC - Code review, consulting, development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is online now   Reply With Quote
 

» Advertisements
» Stats
Members: 175,415
Threads: 94,015
Posts: 402,527
Top Poster: BrianSlick (7,978)
Welcome to our newest member, deannme48
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:32 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.