3 ms·
Good Apple APIs are infamous for their long names. Not sure what they gain by it
by raverbashing 4y ago
Good
Apple APIs are infamous for their long names. Not sure what they gain by it
- Cthulhu_ 4y agoI never minded it so much in Apple code; with the syntax for calling methods, it made method invocations sound like sentences, more like literal programming. Plus, intrinsic named parameters, so many languages - including Go IMO - would benefit from named parameters.
- wingerlang 4y agoNever having to figure out what a function actually does is nice. builder.makeThing("a", true, true, 46) [builder makeThingNamed:"a" isRound:YES isRed:YES size:46] or lately builder.makeThing(named: "a", isRound:true, isRed:true, size:46)
- speedyapoc 4y agoRight? I have never understood the frustration around named parameters like this. It helps reduce cognitive load quite a bit.
- Jiro 4y agoIt increases cognitive load when writing the function call, since you now need to remember what kind of true to use. It also increases cognitive load for people who either do already understand the parameters or who are doing something for which the parameters are not relevant; it's harder to ignore a long thing than to ignore a plain "true".
- masklinn 4y ago> It increases cognitive load when writing the function call, since you now need to remember what kind of true to use. There is no "kind of true". > It also increases cognitive load for people who either do already understand the parameters By letting them see what the parameter they remember is? There's no cognitive load to seeing what you expect. > or who are doing something for which the parameters are not relevant; If the language doesn't have optional parameters, all parameters are relevant. By making parameters named, you avoid having to count positional parameters as in MS APIs to ensure you didn't get one in the wrong slot. > it's harder to ignore a long thing than to ignore a plain "true". Which is very much valuable. It's much easier to notice mistakes than when you've got 11 positional parameters of which 2/3rds are usually set to 0/null.
- masklinn 4y ago> Apple APIs are infamous for their long names. Not sure what they gain by it Clarity. It's also a factor of Objective-C's compound methods (inherited from Smalltalk), as each parameter names appears in the method, and which leads to a very phrase-like style. By osmosis, the C APIs use a similar style.