https://kotlinlang.org logo
#getting-started
Title
# getting-started
u

ursus

09/21/2021, 12:42 AM
Hi, If use a 3rd party library, like lets say moshi, and I create useful extensions, and useful columnadapters etc, and want to distribute this to other consumers (internally). How should I name this module? Is the X suffix common place in kotlin in user space as well?
:moshix
? or more conservative
:base-moshi
? (
:sqdelightx
,
:retrofitx
etc) same goes for my custom
Flow
operators, since flow likes to keep it bare bones
a

Adam Powell

09/21/2021, 12:56 AM
foox
usually implies that you own
foo
,
yourlibrary-otherlibrary
is common, but there are as many opinions on this as stars in the universe
u

ursus

09/21/2021, 12:59 AM
so how would you name the example,
ext-moshi
?
moshi-utils
?
I think utils is banned word in kotlin 😄
a

Adam Powell

09/21/2021, 1:09 AM
Probably something like
yourlibraryname-moshi
or something 🤷‍♂️
j

Joffrey

09/21/2021, 9:30 AM
Google's approach in Android libraries is to use
libraryname-ktx
AFAICT, but as @Adam Powell said it sort of implies you own the lib.
a

Adam Powell

09/21/2021, 2:08 PM
Our use of
-ktx
is highly specific and only indicates converting the "host" library's existing APIs to more idiomatic kotlin usage, not adding new features
For example, adding
suspend
extensions to a library otherwise heavily based on callbacks or
ListenableFuture
j

Joffrey

09/21/2021, 2:13 PM
Well, this is actually how I had understood the OP's usage: useful extensions being Kotlin adaptations of otherwise Java-like API, but upon reading I may be wrong - it looks like it may be about adding features as well. If that's the case then naming should be based on the features you are adding, so there is no real question of
x
,
ext
or the likes.
3 Views