DEV Community

Discussion on: I'm an Android Developer(Java/Kotlin), pre-middle level, Ask Me Anything!

Collapse
 
shreyasht profile image
Shreyash

Was it easy to switch from Java to Kotlin?
What were the challenges you faced?
I have an Android app in Java. What would be the advantages to convert it to Kotlin?

Collapse
 
devit951 profile image
Ildarov

Hello!
As I said before, if you don't have problems with Java core, you don't face any issues with Kotlin.
And if your Android application had a huge code base in Java, it doesn't make sense convert to Kotlin, even if you decide to convert your application to Kotlin, it had not so big advantages over Java. In my opinion, Kotlin has those advantages over Java: Extension functions, better lambda syntax, receiver functions, var/val. Kotlin just syntax sugar for Java in Android.

Collapse
 
vishnuharidas profile image
Vishnu Haridas

Kotlin is NOT a syntactic sugar for Java.

Kotlin is a complete, functional, object-oriented, type-inferred, modern programming language that can compile to both JVM and binary.

There are many benefits that I can see in writing a project in Kotlin, major benefits including Type Inference, Coroutines, Null safety, Extensions, etc.

Coroutines are inevitable in Android development. It is the modern implementation of Async-Await, which can replace RxJava, AsyncTasks, Callback Hell, or Threads.

In my experience, writing Kotlin code makes development much faster and easier than writing code in Java.

If you want to start in Kotlin, you can write new files/classes in your project in Kotlin. Kotlin can co-exist with Java without much problems.

Once you get the grip, you can convert your existing classes one-by-one to Kotlin.

Thread Thread
 
devit951 profile image
Ildarov

But without knowing Java core, you can't understand Android SDK source code, even more, you can't know how to use some method and how they work from Java standard API without knowing Java CORE. Kotlin stdlib is just a set of extension methods over Java methods.