herbrandson
herbrandson

Reputation: 2417

How do you "speak" a function name to another programmer in objective-c

In c#, if I wanted to tell another programmer to look at a specific function such as Person.GetAge() I would "speak" that function something like...

"Look at Person dot GetAge"

In objective-c this function is [Person getAge] (there is no "dot"). How do people "speak" this to other developers?

Upvotes: 4

Views: 203

Answers (3)

Joshua Weinberg
Joshua Weinberg

Reputation: 28688

If you follow the naming conventions, the selector is supposed to read much like a sentence. (getAge is a nono)

-[Person age] would just be "Person age" -[UIView animationDidStop:@"anim" finished:YES context:NULL] would be "UIView animation did stop, anim, finished, yes, context, NULL"

You'll also see some with withContext and things like that, to make them even more sentence like.

Upvotes: 0

TofuBeer
TofuBeer

Reputation: 61536

I say it the same as I do in any other language... "person's get age". There is no need for the "dot" as it is simply used to denote what class the member belongs to.

Upvotes: 0

Brian
Brian

Reputation: 15706

Generally just read it like it's written, with a short pause between the class and method name. For methods like animationDidStop:finished:context: I don't even bother with the colons.

Upvotes: 1

Related Questions