Each language and platform has its own coding style guide. This goes true when it comes to abbreviations. I've had some debates about whether to use JSON or Json, URL or Url, HTTP or Http.
I personally prefer camelCase, so I'm very happy to see that Kotlin is on my side. See Kotlin Style guide, I think this guide should be applied in other languages, such as Swift đ
Sometimes there is more than one reasonable way to convert an English phrase into camel case, such as when acronyms or unusual constructs like âIPv6â or âiOSâ are present. To improve predictability, use the following scheme.
Beginning with the prose form of the name:
Convert the phrase to plain ASCII and remove any apostrophes. For example, âMĂŒllerâs algorithmâ might become âMuellers algorithmâ.
Divide this result into words, splitting on spaces and any remaining punctuation (typically hyphens).
Recommended: if any word already has a conventional camel-case appearance in common usage, split this into its constituent parts (e.g., âAdWordsâ becomes âad wordsâ). Note that a word such as âiOSâ is not really in camel case per se; it defies any convention, so this recommendation does not apply.
Now lowercase everything (including acronyms), then uppercase only the first character of:
âŠeach word, to yield pascal case, or
âŠeach word except the first, to yield camel case
Finally, join all the words into a single identifier.
Note that the casing of the original words is almost entirely disregarded.
Prose form
Correct
Incorrect
âXML Http Requestâ
XmlHttpRequest
XMLHTTPRequest
ânew customer IDâ
newCustomerId
newCustomerID
âinner stopwatchâ
innerStopwatch
innerStopWatch
âsupports IPv6 on iOSâ
supportsIpv6OnIos
supportsIPv6OnIOS
âYouTube importerâ
YouTubeImporterYoutubeImporter*
Â
About iOS or IOS, I think I would go with IOS. I think React Native thinks so too
NavigatorIOS looks and feels just like UINavigationController, because it is actually built on top of it.
Each language and platform has its own coding style guide. This goes true when it comes to abbreviations. I've had some debates about whether to use
JSON
orJson
,URL
orUrl
,HTTP
orHttp
.I personally prefer camelCase, so I'm very happy to see that Kotlin is on my side. See Kotlin Style guide, I think this guide should be applied in other languages, such as Swift đ
About
iOS
orIOS
, I think I would go withIOS
. I think React Native thinks so tooRead more