We will be exploring the reasons why we adopted Kotlin, our expectations going in, our practical findings along the way, and the impact on our way of coding and the impact on the team.
var statusCode: Int? = 0 fun updateString(nullableString: String?): Int { // this won't fly nonNullableString = nullableString // and neither will this return statusCode } }
shows it * * @param[text] Text to display * @param[duration] Duration of [Toast] (defaults to [Toast.LENGTH_SHORT]) */ fun Activity.showToast(text: String, duration: Int = Toast.LENGTH_SHORT) { Toast.makeText(this, text, duration).show() } // Bye bye makeText, say hello to showToast("NEVER FORGETTING TO CALL show() AGAIN")
up • Excellent IDE support (not entirely unexpected) • Language features such as higher-order functions are a game changer • Standard library full of extremely useful helpers • Zero NullPointerExceptions
learning curve • Writing idiomatic Kotlin takes practice • Code reviews can be tricky with evolving conventions • Refactoring in AS seemed less smart than for Java • Standard library is currently ~10% of the dex limit • With great power…
as RxJava • As of 1.1, annotation processing should be significantly improved • Java is difficult to go back to • I barely remember what a semicolon looks like ;-)