3 ms·
As much as many people seem to hate the way Objective-C does things, I really like how it intersperses the arguments in the function name. It makes it so easy t
by MBCook 14y ago
As much as many people seem to hate the way Objective-C does things, I really like how it intersperses the arguments in the function name. It makes it so easy to identify parameters.
Most languages:
someObject.throwProduce(apple, myEnemy, 14, 17);
Objective-C:
[someObject throwProduce:apple at:myEnemy withForceInN:14.0 maxDisanceInM:17.0];
As long as you name the function appropriately, it's clear what each parameter does without having to look up the name. Many people complain about the long names (in this case throwProduce:at:withForceInN:maxDistanceInM:thenWaitInMS:), but it avoids the situation you have in other languages where there are 4 functions with the same name but different signatures. In Obj-C the naming conventions discourage such ambiguity and encourage self-documenting names.