Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8805685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:55:48+00:00 2026-06-14T01:55:48+00:00

Not a complete noob I am quite new to iOS programming and to Ojbective-C.

  • 0

Not a complete noob I am quite new to iOS programming and to Ojbective-C. I mainly come from a background of C (DSP, Microcontrollers), Delphi XE2/Pascal , Visual Basic and Java (desktop and Android apps).

I mainly learned Cocoa with the book “Beginning iOS 5 Development”, from Apress.

Recently I watched videos of the WWDC 2012 and went through some of their sample code, and I must say that I am confused of what is the proper way of writing my apps and more specifically with the @property/@synthesize words.

In the book most (not to say all) of the sample code uses to define a property as for example

ViewController.h
@property (strong, nonatomic) NSMutableArray *list;

ViewController.m
@synthesize list;

then all the code access synthesize list with

self.list

or even simply

list

Now in every WWDC code sample I read I see that programmers define a property but then, in the .m file they do things like

@synthesize list = _list;

and access sometimes

self.list

or

_list

I am confused. What is the correct practice ? As Apple programmers all use underscore I think I should do it that way but why the book did not ? Is there a difference between list and _list ? And more over, as I am in the same object why sometime use self.list and sometimes list/_list.

Sometimes they don’t use @synthesize, I assume it’s when they want to re-write their own accessors and mutators (which is never my case up to now).

I have read here and there on the web but nothing was clear enough to set my mind right, so I count on StackOverflow to bring light here.

Last but not least I prefer and answer based on current iOS 6 best practice/programming technique. Useless to tell me how to do it correctly in older iOS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:55:49+00:00Added an answer on June 14, 2026 at 1:55 am

    There is no correct way. There is only your preferred style.

    The lastest compilers do an implicit synthesise on the property declaration.

    @synthesize list = _list; .

    Nothing is ever written in your code. It just happens.

    However that doesnt stop you doing this explicitly.

    @synthesize list = somethingelse;

    So when you ask for a pointer to list via the accessor (self.list) you will get a pointer to somethingelse

    In most cases NSMutableArray *thing = self.list is equivalent to NSMutableArray *thing = somethingelse

    And just because Apple uses a style doesn’t mean that you have to do it. Each company usually has their own coding style.

    The main problem with using @synthesize list; is that it poses the risk that you can write either

    self.list = thing or list = thing .

    The former uses the sythesised setList: accessor while the latter doesn’t and put the risk of related bugs in your code , though its not as bad with ARC as you dont get leaks happening for strong properties.

    What ever style you use, keep it consistent and be aware of the effects of using an ivar directly list = thing as compared to using its accessor self.list = thing

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone.. I'm not a complete noob to linux, I'm using Fedora 16, but I've
The current form is here . It is not complete, and only a couple
I have a mysql problem, my query looks as follows but not complete SELECT
I've been googling for a while now, I found some not complete tutorials how
I'm reading the not so complete pytz documentation and I'm stuck on understand one
HI all, Firebug is not displaying Complete js file to debug. I m unable
I need a field for store only a year, not a complete date. Can
Can someone please tell me whats wrong with this code. I'm not getting complete
I've seen a number of posts on UIGetScreenImage, however, not a complete working (short)
I'm not sure if this is possible (complete non-flash developer speaking), but we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.