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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:40:53+00:00 2026-06-03T23:40:53+00:00

Possible Duplicate: With ARC why use @properties anymore? NB: I actually don’t think we

  • 0

Possible Duplicate:
With ARC why use @properties anymore?

NB: I actually don’t think we can do away with properties, but I’m trying to understand the reasoning as to why not. 🙂

Referring back to this question, it seems like the principal reason we use properties is to avoid memory management issues. In other words, by creating a property we rid ourselves of the need to write out all these retain and release methods:

- (void) setOtherObj:(MyOtherObject *)anOtherObject {

    if (otherObject == anOtherObject) {
    return;  
    }

    MyOtherObject *oldOtherObject = otherObject; // keep a reference to the old value for a second
    otherObject = [anOtherObject retain]; // put the new value in  
    [oldOtherObject release]; // let go of the old object
} 

Since ARC deals with this now, could we not do away with properties all together and just set ivars by doing something like otherObject = anotherObject?

  • 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-03T23:40:55+00:00Added an answer on June 3, 2026 at 11:40 pm

    Memory management is one reason to use properties, but not the only one. You can only use plain instance variables within your own class, but not from outside. For that, you still need a property.

    Properties don’t even have to be backed by instance variables. For example, you might have a backgroundColor property in a view that actually returns and sets the backgroundColor property of some private subview.
    Or, say you have a readonly name property that actually doesn’t correspond to an instance variable, but simply concatenates firstName and lastName.

    Using properties instead of plain instance variable access also allows you to implement lazy initialization more easily, without having to change your code in a lot of places.

    If you only use a property to handle memory management for you, you could do without it in a lot of cases now, but using a property still gives you more flexibility when you later decide that it shouldn’t simply map to an instance variable.

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

Sidebar

Related Questions

Possible Duplicate: When converting a project to use ARC what does “switch case is
Possible Duplicate: How do I use define_method to create class methods? I am trying
Possible Duplicate: Why is object not dealloc'ed when using ARC + NSZombieEnabled I've got
Possible Duplicate: How can I combine multiple rows into a comma-delimited list in Oracle?
Possible Duplicate: Should IBOutlets be strong or weak under ARC? In the documentation, I
Possible Duplicate: How is release handled for @synthesized retain properties? I saw someone mention
Possible Duplicate: Can a Bash script tell what directory it's stored in? Is there
Possible Duplicate: iOS: to ARC or not to ARC? Pros and Cons i have
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: how to use foursquare API in android application? This is a question

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.