|
|
|
|
|
by greggman
3798 days ago
|
|
Do you also pronounce every abbreviation? Do you say "International Business Machines" instead of "IBM"? How about "Répondez s'il vous plaît" vs "RSVP". "As soon as possible" or "ASAP". Ever use a contraction? How about a keyboard shortcut? I certainly agree it's potentially more readable at first. I'm not yet convinced, without actual data, that anyone, given a month or so experience with a given and common API wouldn't be more productive with shorter names up to a point. I would be good to get that data. Maybe I'd be better off with a = Math.numberFromAddtionOf2Numbers(c, d)
e = Math.numberFromDivisionOf2Numbers(numerator: b, denominator, c);
vs a = c + b;
e = b / c;
which is best s = str.stringByReplacingOccurrencesOfString(" ", withString: "", options: .LiteralSearch, range: nil)
s = str.replace(" ", "");
s = str.r(" ", "");
|
|
https://swift.org/documentation/api-design-guidelines/#be-gr...
This is a bit more verbose if you need to chain a lot of replacements... but chances are you shouldn't be doing that in the first place! Instead there should be a version that takes a dictionary, like
This is better because most of the time you don't actually want characters produced by earlier replacements to match later ones, and it can be faster for large strings.