Skip to main content

Kotlin

Table of Contents

What is Kotlin?
#

Kotlin is a multi-purpose programming language that runs in the JVM. In many ways, it’s what Java would have been had it been designed 20 years later.

Kotlin code is much more concise than the equivalent Java. It has native features that address many of the gripes that programmers have about Java, including the following:

  1. Null safety is built-in.
  2. Fields are implemented as Properties that include default (but configurable) getters and setters.
  3. The ability to add methods and fields to classes without formally extending them.
  4. Semicolons are optional!
  5. Automatic inference of data types when declaring Variables
  6. Default values in method signatures, reducing the need to overload methods.

Kotlin is 100% compatible with Java, so you can freely use any libraries that are written in or for Java. With a few caveats, you can also call all of you Kotlin code from Java. You can even mix Kotlin in with Java in the same project!

Of course, Kotlin works really well with JavaFX. In fact, JavaFX is way better with Kotlin than it is with Java.

Read More…
#

I’ve written a few articles about Kotlin, you can find them here:

Kotlin For JavaFX

18 mins

Introduction
#

I’ve been using Kotlin for a while now, and I’ve been using it to write JavaFX applications. What I’ve found is that the things that make Kotlin better than Java, make Kotlin way, way better for JavaFX.

Kotlin For Java Programmers

19 mins

Introduction
#

The first time I ever looked at a Kotlin program was when one of my developers found a cool JavaFX library called “DirtyFX”. We wanted to understand it worked, but when we looked at the source code on GitHub we were stymied because it was in Kotlin.

Kotlin - Should You?

11 mins

Kotlin has been described as, “The language that Java would have been if it had been designed 25 years later”. It’s starting to pick up popularity, and has had a boost from being endorsed by Google for Android development.

Kotlin: JavaFX Properties

JavaFX Properties
#

In JavaFX, properties and other observable classes are used to implement reactive programming techniques - which is absolutely the best way to design a JavaFX application. Ideally, you should implement your data elements as properties and then use the Binding library to connect the data to your GUI.