Small thing that is itching me. It's `JSON` and no...
# naming
m
Small thing that is itching me. It's
JSON
and not
Json
, right? I've been using
Json
everywhere but I think I'm wrong?
To my defense, kotlinx.serialization is using Json too
What do you use?
s
The acronym is JSON, but most code styles I’ve seen will recommend converting acronyms to title case to avoid what I call the
HTTPURLConnection
problem
i.e.
HttpUrlConnection
>
HTTPURLConnection
c
Yeah I always use eg HttpUrlConnection, because it’s possible for acronyms to merge in unclear ways
s
The Kotlin code style is no exception:
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
1
m
Ah! Perfect!
c
Like HTTPSFTP, what protocols does this refer to?
l
my favourite example is the classic XHR:
XMLHttpRequest
. best of both worlds. 😄