JavaFX Tutorial: Kotlin vs Java, which is Better for JavaFX?

preview_player
Показать описание
Recently, I have been experimenting with the combination of JavaFX and Kotlin. As Kotlin also runs on the Java Virtual Machine (JVM) and is a very close sister of Java, the switch is straightforward. In this video, I show you the difference in code style.

You can also find the description on my blog:

And here are the sources of the project used in this tutorial:

More info about MelodyMatrix:

00:00 Intro
00:13 What is Kotlin?
01:11 About the demo project on GitHub
01:32 Comparing the code in Kotlin and Java
04:31 Running the demo application
05:51 How this is used in MelodyMatrix
07:05 Conclusion
Рекомендации по теме
Комментарии
Автор

You can achieve the same thing in Java using builders, except that builders allow you to create immutable objects via the ctors, while this approach in Kotlin creates a mutable object and calls setters afterwards - not ideal

delanym
Автор

Nesting code blocks endlessly is certainly not readable. Just write code line by line like Java. Compared to Kotlin, Java code is much more readable and becomes easy to reason about when the application grows

aadu_thoma
Автор

In my opinion, the Java version that is more readable and easy to understand.
The best way to create UIs is using the declarative DSL instead of the imperative java/kotlin code.
Thanks

elbachirnouni
Автор

Is there any exemple out there with groovy?

akemegbebu
join shbcf.ru