Hi, I'm looking for some feedback on a couple of n...
# naming
l
Hi, I'm looking for some feedback on a couple of naming changes I'm currently considering for some of my libraries. Please also take into consideration that this is completely used from Java too. (I would also be interested to hear if this affects your stance on naming.) I believe that the new names are more conventional but I'm biased because I'm used to the old notation. So I would love to get some opinions: • Replaced occurrences of 🅰️
ID
in identifiers with 🅱️
Id
. • Renamed 1️⃣
NPCText
,
PoI
(point of interest), and
PvPGame
to 2️⃣
NpcText
,
Poi
, and
PvpGame
respectively. Thanks 🙂
🅰️ 1
1️⃣ 1
2️⃣ 13
🅱️ 14
b
Both feel pretty much equivalent to me. Are you sure it's worth a rename?
👌 1
k
I would try to conform to both Kotlin naming conventions and Java naming conventions as long as the identifier looks reasonable. By the way, I always prefer "Id" over "ID" because it's not an acronym nor an initialism; it's an abbrevation for "identity/identification/identifier", and abbreviations are not capitalised. However, it seems that "ID" is a common exception even though it looks wrong to me.
👍 1
l
@bod Since it's not 1.0 yet, I'm not to worried about the cost of renaming. In fact, I think it's important to get this right before API stabilization to make sure that the library feels natural to use and blends into the ecosystem. One argument that was brought up by a friend is that some tooling usually assumes camelCase.
b
All right 👍. In that case I have a slight personal preference for
Npc
and
Id
but I'm pretty sure I saw somewhere that Kotlin encourages uppercase for abbreviations if they're 2 or 3 letters - but can't find this anymore.
l
There is a section about acronyms in the coding conventions. As stated, this is one of the things that convinced me to consider renaming. I guess it feels a bit weird to me because I got used to the old names. > When using an acronym as part of a declaration name, capitalize it if it consists of two letters (
IOStream
); capitalize only the first letter if it is longer (
XmlFormatter
,
HttpInputStream
). https://kotlinlang.org/docs/coding-conventions.html#choose-good-names
b
ah yes that's the one (I thought 3 letters would also be capitalized, but I guess I just remembered incorrectly 😅)
well I just voted B and 2, but it's a really slight preference, and I think both are allright 👍 🙂
👍 1
e
IMO current Java style would also tend towards the latter, so I wouldn't be concerned about it looking out of place
👍 1