Hi there people, I am looking into the use of KMM ...
# multiplatform
s
Hi there people, I am looking into the use of KMM for our company, but I am unsure what amount of work that would entail. We currently use J2Objc to convert our (quite large) stack to ObjC and build a Framework out of that. Our Android application is quite small, mainly using existing Java libraries that at some point interface with C++ libraries via JNI. The main point of the application is to connect to devices on the network and transmit vast amounts of data (but everything is already handled in the underlying libraries) Basically the question is if simply switching from J2ObjC to KMM seems feasible (without too much overhead)
t
our company also switched from j2objc to KMM. The first thing you should realize is j2objc is a tool for Java, KMM is a tool for Kotlin. Java code will need to be ported.
👏 1
s
How did you achieve this/How would you say is the best way to achieve this?
t
Java to kotlin converter should speed it up significantly. Probably project structure and some portion of the code will require some adjustments as well. Some futher adjastment will be addvisiable to get closer to kotlin ecosystem. But I haven't used it, nor I am mobile developer. I just want to share some of my experience regarding estimations for migrations to new technologies. The approach I used for estimation at my previous work where it came to changing technologies was to explain how much developers estimations out of the air are inaccurate and ask for some time to do as much time as they could spare me to just do small portion of migration, but measure it as precisely as Ii could - how much time it took to migrate compared to what is the portion of the features in task, lines of code, time it took to initially write it and most importantly - how much time we spend on maintaining the code and implementing new features. This might be convincing to your PM/boss as those are the numbers they are looking for and probably they already know the risks of non-methodological estimations being waaay off. So paing you for the estimation is for them it's the cost of making right decision.
👍 1
Ah, there was one more important metric I used - what portion of code was reduced during migration : )
s
Thanks for your detailed answer! Can you possibly point me to any materials you found helpful when you were working on this?
t
in our case we did not transition existing projects, just small parts of code we use. We took it as an opportunity to rebuild our stack. That of course is not the low friction solution you are looking for. That said, porting java JVM code to kotlin JVM code is easy (can be done practically automatic, IDEA/AS even has a button for it). porting good java code to good kotlin code is way harder (but worth it!). Porting Kotlin/JVM to KMM is it’s own set of problems though.. and calling into native libraries as an approach can also be kept but the tooling you use for this will also change.
👍 1
generally speaking, it simply is a big step, but it has a big pay off. for our company developers mostly saw j2objc as obscure technology they accepted dealing with but preferred to stay away from, whereas KMM is something they are more invested in as a technology. Also 95% will prefer Kotlin over Java in my experience. Swift developers are more ok with Kotlin vs Java too.
something about your description confuses me though, you on the one hand have “a quite large stack” of presumably Java code you use for iOS, but the android application is “quite small, mainly using existing Java libraries that at some point interface with C++“. I’d assume Android would also use your quite large java based stack?
s
Yes sorry, I just meant that the Android-specific stuff is quite small. The App still uses tons of legacy code. But thank you for your answer!