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 8302205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:13:38+00:00 2026-06-08T17:13:38+00:00

There’s a lot out there on why to go through a @synthesized setter (instead

  • 0

There’s a lot out there on why to go through a @synthesized setter (instead of accessing the ivar directly), for retain/copy memory management, or for KVO.

But I can’t think of a good argument for why you’d care if you used foo = self.bar, or foo = bar.

The only thing I can think of is for data abstraction…if bar is a declared property, then the underlying implementation could change and no one else would care. (Of course, in this case, you’d probably not be using a @synthesized getter)

So…any compelling reasons to use @synthesized getters? Is there some threading issues that make it important?

For that matter, what does the @synthesized code even do, other than just return the ivar?

  • 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-08T17:13:41+00:00Added an answer on June 8, 2026 at 5:13 pm

    One good reason is encapsulation. When you go through the accessor, the class is free to do whatever tricks it wants behind the interface (as you already said in your question). The value may be fetched lazily, it might be computed on the fly or fetched from other object. That said, inside the class implementation I usually use the plain ivar access, as I am free to rewrite this if the property implementation changes. (This used to be a bigger issue when private ivars were declared in the public header, so that your subclasses could access them directly.)

    As for threading, I think the default getter/setter combination is atomic, meaning that you can’t get a bug where the getter would be called in the middle of the setter, getting some invalid value. I’ve never read much into this issue, check out the documentation for the nonatomic property modifier. (Or this related question.)

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

Sidebar

Related Questions

There are a lot of blogs saying that a hasOwnProperty check should be used
There's a few previous questions on StackOverflow questioning how one goes about accessing local
There are a lot of Jquery plugins and libraries. and sometimes I want to
There are a lot of questions about full-joining in mysql(5.1.36). Of course the solution
There's a lot of reading on self referencing problems, but I can't seem to
There are lots of posts on here about moving a folder out of one
There is a constant I'm using from the iOS SDK. I printed out the
There is a perforce bundle for TextMate but I can't get to auto-check out
There is a moment in my app, that I need to force to show
There is a column that exists in 2 tables. In table 1, this column

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.