https://kotlinlang.org logo
#announcements
Title
# announcements
f

Fabio

02/18/2021, 10:06 PM
I'm looking for some wisdom on writing Kotlin libraries, specifically for Android in my case, specifically for helping write the couple of apps that I support. Sometimes I feel like it's too hard to balance what goes in the library and what goes in the app, or the libraries are too small and not worth it. Any tips?
1
b

Big Chungus

02/18/2021, 10:46 PM
Even if the library is a single package, it's worth it if that means not maintaining multiple copies of that code in the projects. Have a look at npm, there are thousands of single function packages that are widely used
n

napperley

02/19/2021, 3:13 AM
This thread should be moved to #android.
b

Big Chungus

02/19/2021, 8:34 AM
Why? Android has nothing to do with the question
👍 1
m

Matteo Mirk

02/19/2021, 10:28 AM
Why the - reaction? It’s a perfectly legit question about library design.
f

Fabio

02/21/2021, 10:21 PM
thx folks, because of timezone I think the replies showed up after my Friday was finished. There's a significant overhead of having and editing and building new versions of libraries. I'm not familiar with npm libraries development cycles when tightly or loosely coupled with application development, So I can't say if that argument is reasonable or not to my goals.
m

Matteo Mirk

02/22/2021, 10:36 AM
Personally, I wouldn’t take npm’s trend of single-function libraries as a virtuous example, quite the opposite in fact, as the left-pad incident showed! What you need to consider is how much common code exists between the apps that could go into the library. I wouldn’t put UI code into the lib, because that would probably need to change independently from one app to the other. Surely I would group together common logic, configuration and utilities, pretty much anything you have duplicated between the code bases and think it could be shared. Keep in mind that you’re creating a lib specific to your apps, so you don’t need to design it for a general usage, like Guava for example.
1
💯 1
b

Big Chungus

02/22/2021, 10:58 AM
I was talking more from internal libraries side of thing. Basically as a way to maintain DRY code
f

Fabio

02/25/2021, 3:21 AM
Yep it's all internal use at the moment , and my biggest goal is Dev speed and avoid repetition
3 Views