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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:49:47+00:00 2026-05-11T21:49:47+00:00

One of the things I like most about Cocoa is the readability factor. One

  • 0

One of the things I like most about Cocoa is the readability factor.

One of the things that annoys me the most is the convention of convenience constructors to force repetition.

Here’s an example:

[NSString stringWithString:s]

[NSNumber numberWithDouble:d]

[NSValue valueWithInt:i]

[NSDictionary dictionaryWithObjectsAndKeys:<blah>]

etc.

Why doesn’t the convention simply start convenience constructors with the word “with”? so then we would have:

[NSString withString:s]

[NSNumber withDouble:d]

[NSValue withInt:i]

[NSDictionary withObjectsAndKeys:<blah>]

etc.

It’s a minor discussion point, but one I thought I would just throw out there and see if anyone with more clout than me can explain all the echos in my head.

Obviously, I’m not going to petition AAPL to re-write the appKit in favour of my suggestion, but are there any arguments against naming my own convenience constructors as such?

Of course I can use whatever conventions I want in my own code but I hate to swim upstream blindly.

  • 1 1 Answer
  • 2 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-05-11T21:49:47+00:00Added an answer on May 11, 2026 at 9:49 pm

    There is actually a technical reason for it to be that way. If every shoelaceWithString:-type method were changed to just withString:, we would end up with a fearsomely huge number of classes with identically named methods and different signatures. This plays mean tricks on the compiler’s static type checking and can cause it to throw up all sorts of annoying and unnecessary warnings.

    There’s also an aspect of Cocoa culture where developers like their code to be self-documenting. This means that method names indicate both what their arguments are and what they return. Apple’s coding guidelines actually warn about methods with vague names, suggesting that adding words to the name to make it clear what a method does is preferable.

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

Sidebar

Related Questions

I use VSTO Excel template based solutions frequently. One of the things I like
One of the first things I like to do when I make a site
One of the things I would like to follow is to stick to the
One thing I have continually found very confusing about using an object database like
i notice one nice things that a amazon provide that is load pdf data
One of the things that block objects, introduced in Snow Leopard, are good for
This is one of those things that you read once, say aha! and then
I know, that I am not the first one to try to use Cocoa
One thing i noticed about WPF is that it combines various concepts from other
Recently I was working with some strings, text input, things like that and I

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.