Skip to content

A live-coding introduction to Kotlin for Java programmers

License

Notifications You must be signed in to change notification settings

reitzig/kotlin-introduction

Repository files navigation

A Hands-on Introduction to Kotlin

This repository contains code along which to present Kotlin to other programmers who are familiar with Java. The main example are binary trees.

The goal is to make people excited about Kotlin so they want to learn it, not so much to teach them right now. Therefore, this introduction bothers less with elementary syntax than e.g. kotlin-workshop does. Instead we demonstrate some (pseudo)-real code and discover features of Kotlin along the way.

We cover the following features of Kotlin:

  • Basic syntax (incidental and thus incomplete; coverage depends on presenter)
  • Null safety through optionals
  • Type inferrer
  • Optional parameters
  • Named parameters
  • Lambdas & higher-order functions
  • String comprehensions
  • Data classes
  • Sealed classes
  • Extensions
  • Java interoperability
    • Basic usage in both directions
    • Synthesized properties resp. getters/setters
    • Null-safety via annotations in Java
    • Lambda compatibility

Roadmap

  1. Start by showing JTree.java and JTreeTest.java -- this is just to get people up to speed about what the goal is.

  2. Live-code the Kotlin tree implementation. Follow the steps outlined in Ktree.kt and then KTree2.kt.

  3. Demonstrate using Java from Kotlin following the steps outlined in PersonTest.kt.

  4. Demonstrate using Kotlin from Java following the steps outlined in TreeTest.java.

You should plan roughly one hour including questions.

More Resources

For learning Kotlin, I recommend:

Acknowledgements

This introduction was developed while preparing an internal training event for Telepaxx Medical Archiving and reworked for a similar session at codecentric.

About

A live-coding introduction to Kotlin for Java programmers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages