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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:12:52+00:00 2026-06-15T04:12:52+00:00

I want all my instance variables private and accessors/mutators in public methods. I am

  • 0

I want all my instance variables private and accessors/mutators in public methods. I am wondering if there is a naming convention that I should be aware of when building large classes, a convention both for readability among other developers, but also a convention that prevents method name clashing with other classes.

For example, if I want a class to access and change a “quality” (not necessarily a specific variable) called “supports musicians,” would [myInstance setSupportsMusicians:YES] and [myInstance returnSupportsMusicians] be acceptable names, using set and return as method name prefixes for all other mutators and accessors?

Obviously I know I can name them anything I want, but I wanted to get some opinions since I know naming conventions are a significant component of organized development.

  • 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-15T04:12:53+00:00Added an answer on June 15, 2026 at 4:12 am

    You’d be best off using @property to declare things like this. That way you can get all its implementation benefits (like atominicity, automatic ivar generation, etc) along with convenient dot syntax (e.g. myInstance.supportsMusicians = YES), all without having to worry about the underlying method names at all.

    But in case you do want to declare your methods manually, or just want to know what the auto-generated ones are, the naming convention is:

    - (void)setSupportsMusicians:(BOOL)supportsMusicians;
    - (BOOL)supportsMusicians;
    

    There’s also a side-case for some types of booleans properties, where “is” is used as a prefix for readability, e.g.

    - (BOOL)isVisible;
    

    This is not followed universally, however, and might be considered a legacy convention.

    Note that “get” as a prefix shouldn’t be used randomly as it has a specific meaning: it’s used in a context where the caller provides a buffer to be filled in, e.g. -[NSString getBytes:length:].

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

Sidebar

Related Questions

We want to search a file to find all instances of bar that are
I want all products that contain images to be listed before products that do
what i basicly want is this: public class Test { private static final Integer
If I want to list all methods for a class I can use Class_Name.methods
I want to replace all instances of '::memcpy()' with my custom made 'customMemcpy()' defined
In this string: <0> <<1>> <2>> <3> <4> I want to match all instances
I want all the views of Row in OnListItemClick() Actually I want to change
I want all my inno set up pages to look like below :
I want all labels inside a detail view to be bold. I created a
I want all my applications log to be centralized (ideally in near real-time). We

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.