1

What name is better for the "delete" method that deletes document in database with given documentID?

1) -(void) deleteDocumentWithID:(NSString *) documentID error:(NSError **)error;

or

2) -(void) deleteDocumentByID:(NSString *) documentID error:(NSError **)error;

1
  • 3
    By or With ID is up to you (I'd prefer withID). But the parameters should be of type NSString* and NSError** Commented Aug 16, 2013 at 8:04

2 Answers 2

2

Have a look at Programming with Objective-C

  • Method names do not have a prefix
  • Method should start with a lowercase letter
  • camel case is used for multiple words
  • If a method takes one or more arguments, the name of the method should indicate each parameter
  • Error should be the last parameter to the method

enter image description here

By and with depends on you

 -(void) deleteDocumentWithID:(NSString *) documentID error:(NSError **)error; -(void) deleteDocumentByID:(NSString *) documentID error:(NSError **)error; 
Sign up to request clarification or add additional context in comments.

1 Comment

And from the point of English grammar, what is better in this case "By " or "With" ?
2

Your naming conventions are completely up to you, as mentioned in the apple doc try and be as descriptive as possible with your method names so any third party looking at your code (header file) will be able to get an idea quickly on what the method does. From the code you posted you are on the right track.

Have a look at this document.

Apple Conventions

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.