Special Topic: Programming in Kotlin

KV 339.360 Prähofer, Weninger, Fried 2 KV 6 Dates: Th. 09.11.2023, Fr. 10.11.2023, Th. 23.11.2023, Fr. 24.11.2023, Th. 30.11.2023, Fr. 01.12.2023 Rooms: see below

Objectives

This course offers an introduction to programming in Kotlin, presenting its most important concepts and features. It assumes that participants have prior knowledge in another object-oriented programming language such as Java or C#.

We do not cover the whole syntax and Kotlin library - please refer to the online documentation for this:

This course focuses on Kotlin on the JVM and the language itself - it does not cover Android programming.

The material, homework exercises, etc. will be provided via Moodle.

Mode

Mandatory attendance, either online or presence ("live hybrid teaching"). Live streaming link will be provided in Moodle.

Topics

  • Introduction, History, and Goals of the Language
  • Tour through Kotlin ("Overview")
  • Language Basics (Types, Arithmetics, Strings, Array, Collections, Main Differences to Java, Immutability, Nullability, Type Inference, Control Flow - if/when/for/while, etc.)
  • Functions (Parameters (Default Parameters, Named Arguments), Single-expression Functions, Varargs, Infix, Extension Methods, Introduction to Function Types)
  • Classes (Constructors and Initializer Blocks, Properties, Inheritance, Interfaces, Data Classes, Nested / Inner Classes, Enum Classes, Object Expressions and Declarations (Singletons), Companion Objects, Operator Overloading)
  • Reflection
  • Delegation and Delegated Properties
  • Notable Pitfalls when using Kotlin
  • Idioms ("Typical Kotlin")
  • String Extension Methods
  • Generics (on Classes/Interfaces/Functions, Constraints, Nullability, Reified Types, Co- and Contravariance, Declaration-site and Use-site Variance)
  • Functional Programming Concepts (Tail-recursion, Immutability, Lambda Expressions, Anonymous Functions, Function Types, Higher Order Functions, Inline Functions, Labels, Eager Processing / Lazy Processing, Lambdas with Receivers, Scope Functions, Builder Pattern)
  • Higher Order Functions for Collections
  • Java Interop
  • Construction of DSLs (domain-specific languages) using Kotlin
  • Industry Experience Report: Journey through Java, Scala and Kotlin

Dates

  • Thu. Nov 09, 2023: 17:15 - 19:45, S2 048
  • Fri. Nov 10, 2023: 10:15 - 11:45, S2 048, 12:45 - 15:15, S2 048
  • Thu. Nov 23, 2023: 17:15 - 19:45, S2 048
  • Fri. Nov 24, 2023: 10:15 - 11:45, S2 048, 12:45 - 15:15, S2 048
  • Thu. Nov 30, 2023: 17:15 - 19:45, S2 048
  • Fri. Dec 01, 2023: 10:15 - 11:45, S2 048, 12:45 - 15:15, S2 048
  • Exam: Thu. Jan 11, 2024: 17:15 - 18:00, HS 2

Methods

  • Slide-based presentations
  • Live coding and programming examples
  • (Small) Homeworks
  • Project (Topic of your choice)
  • (Small) Exam

Language

English

Criteria for evaluation

  • (Small) Homeworks
  • Project (Topic of your choice)
  • (Small) Exam

Primary Literature

  • D. Jemerov and S. Isakova: Kotlin in Action. Manning, 2017

Secondary Literature

  • J. Skeen and D. Greenhalgh: "Kotlin Programming: The Big Nerd Ranch Guide", Big Nerd Ranch Guides, 2018 (2nd edition is planned as print for October 2021, eBook already available)