Wondering if avoiding Java imports is good for lon...
# getting-started
b
Wondering if avoiding Java imports is good for long-term portability (i.e. It makes it easier to do to native or JavaScript, rather than JVM).
l
If there’s an equivalent that supports KMM and can be easily used instead, I’d lean towards that, but be careful about doing too much premature optimization if there’s no roadmap for non-JVM yet.
👍 2
r
If there's a common / multiplatform alternative, I tend to prefer them, but only because they tend to be more idiomatic, not because it makes it more "portable". Designing for multiple platforms is an intentional thing.
👍 2
b
I was looking at stuff for rounding and most of it was Java libs but as it was for output I ended up with
Copy code
percentagePurchased = String.format("%.2f", ((purchasedTickets.toDouble() / totaltickets) * 100))
which as it was all built in (which is what i guess you mean by common) I went for that.
l
If there’s a good JVM library that handles rounding, but not one for KMM, I’d just use the JVM one unless multiplatform is on the roadmap.
b
Thanks, so maybe KMM unless it makes things difficult.
l
Yeah. I’d do KMM unless it’s any extra effort, or you know for sure you’ll need multiplatform in the near future.
b
So KMM is Kotlin Multiplatform Mobile. Is that different from what I have come across as simply Kotlin Multiplatform (https://kotlinlang.org/docs/multiplatform.html)
l
KMM is a shorthand for android and iOS. Sometimes it's also used to mean the whole of multiplatform, but it's technically a subset.
☝️ 2
r
Unfortunately the acronyms got a bit confusing in the early days of multiplatform. From my experience usually when people say KMM they mean multiplatform in general (which I believe at one point was referred to as KMP or K/MP), and not mobile specifically, but that could be a selection bias as I don't do much mobile.
l
Yeah. KMP is the acronym for the whole of multiplatform. KMM is quite common, so it’s easy to be lazy and just say KMM instead of keeping track of whether you have other targets.
b
OK, not sure if you were doing a iOS/Android app that you also wanted a web app interface for you would do the web interface in Katlin. Douse not seem to be anything like Flask for Kotlin, or am I wrong?
r
I've never used Flask, but is Ktor a suitable alternative? https://ktor.io/
l
Not 100% sure what Flask is, but for web dev, you’d usually use something like the react wrappers or KTor
r
@Landry Norris Hah, this time I beat you 🙂
l
I noticed.
🙂 1
b
I am here to be proved wrong, otherwise what the point :).
Flaks is a Python thing. It integrates with a load of other things that are used for RESTful web apps. I just googled 'KTor vs flask' which was a mistake as I've got shit to be getting on with; -:). However, they are both Microframeworks (backend), which seems good to know
l
I’m not sure that KTor is a microframework in the same sense of http4k. I think it’s somewhere between monolith and microframework.
👃 1