Paid for consulting? More Questions re: Java Chatbot (Phi Rho), Ruby/Kotlin AI Enhancements -> Personal Avatar


#1

People,

I sent a version of this note to the JRuby list and got some useful feedback but before committing to too much effort I thought it would worthwhile getting some feedback from Kotliners - I am also mailing this to my closest group for comment (Sydney).

Given I need to minimise the amount of time I spend learning Java and maximise the amount of code I can produce in Kotlin, does it make sense to REWRITE some of the existing Java chatbot modules in Kotlin?

It appears the Kotlin code be integrated in the JAR file?

If that were possible then I could just rewrite the bits that need changing for the enhancements I am thinking of and I will then hopefully be able to continue developing most of the future code myself THEN maybe I only need to pay someone to do enough of the rewriting to get me started on each module that needs changing . .

Thanks,

Phil.


Moving a 14 module app from Ant to IDEA
#2

Hello Phil,

You don’t need any rewriting.
But there are a couple of suggestions:

Nullability

Kotlin has null in it’s type-system. Java doesn’t. This can be fixed by using nullability annotations. This is not needed, but when you don’t you interact with platform type. This is a type which can be dealth with as either nullable or not-nullable. This is not a big issue if you know what the return-type is.

Lambda’s

In Kotlin, if the latest parameter is a lambda, it can have a different notation:

fun test(lamb: () -> Unit) = lamb()
//instead of doing this
fun test({println("hello")}
//you can do this
fun test{
    println("hello")
}

This is a big feature. If you have functions where you pass a lambda, but not as last parameter, I recommend to rewrite it. This is however not needed, as you can fix this in Kotlin by extending the classes.


These are the only things what come to my mind.

Thijs,

PS. converting to Java-like Kotlin is as simple as pressing a shortcut in Intellij.



Hahaha, a bit late :wink: