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

Ben Edwards

08/17/2022, 6:42 PM
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

Landry Norris

08/17/2022, 7:07 PM
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

Ruckus

08/17/2022, 7:13 PM
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

Ben Edwards

08/17/2022, 7:16 PM
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

Landry Norris

08/17/2022, 7:19 PM
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

Ben Edwards

08/17/2022, 7:24 PM
Thanks, so maybe KMM unless it makes things difficult.
l

Landry Norris

08/17/2022, 7:26 PM
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

Ben Edwards

08/17/2022, 7:31 PM
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

Landry Norris

08/17/2022, 7:37 PM
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

Ruckus

08/17/2022, 7:37 PM
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

Landry Norris

08/17/2022, 7:42 PM
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

Ben Edwards

08/17/2022, 7:47 PM
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

Ruckus

08/17/2022, 7:50 PM
I've never used Flask, but is Ktor a suitable alternative? https://ktor.io/
l

Landry Norris

08/17/2022, 7:50 PM
Not 100% sure what Flask is, but for web dev, you’d usually use something like the react wrappers or KTor
r

Ruckus

08/17/2022, 7:50 PM
@Landry Norris Hah, this time I beat you 🙂
l

Landry Norris

08/17/2022, 7:50 PM
I noticed.
🙂 1
b

Ben Edwards

08/17/2022, 7:51 PM
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

Landry Norris

08/17/2022, 8:00 PM
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
2 Views