Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why methods' names are so long in Objective-C [closed]

Tags:

objective-c

I've learned C/C++, Python, Matlab and many other language, but I was really surprised by the long method name in objective-c.

What's the advantage of using long name? Why no other language use long name?

Thanks a lot.

like image 677
Mr.DMS Avatar asked Dec 11 '25 03:12

Mr.DMS


1 Answers

It is something like code convention. Usually it is very useful.

But you can name your methods as you want. Also notice that it is not strongly required to name all parameters. For example you can create method

- (void)makeDateFromDay:(int)day month:(int)month year:(int)year

and call this way

[someObject makeDateFromDay:18 month:2 year:2014];

but you also can name it shorter

- (void)makeDateFrom:(int)day :(int)month :(int)year

and call like this

[someObject makeDateFrom:18:2:2014];

But it is not so readable, yes?

like image 60
Avt Avatar answered Dec 13 '25 16:12

Avt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!