Question

It's more a question about English grammar, but nevertheless, can you tell me which one is a correct method name? This ambiguity drives me crazy.

Method linesNumber returns number of "rows" in some sort of table. I personally like "numberOfLines" variant, but linesNumber is shorter...

#pragma mark - RCGroupDataSource methods

- (NSUInteger)linesNumber { // ???: or numberOfLines or lineNumbers
    return 2;
}
Was it helpful?

Solution

Always give full name as you can.

Method linesNumber returns number of "rows" in some sort of table.

why not use numberOfRowsInTable

You can refer AppleDocumentation and CocoaDevCentral

OTHER TIPS

Describe what is being done:-

getNumberOfLines

The other could be ambiguous

getLineNumbers

Sound more like a plural, ie an array of numbers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top