Special Topic: Programming in Kotlin

KV 339.360 Prähofer, Weninger, Fried 2 KV 6 Lecture Dates + 1 Exam: Th. 07.11.2024, Fr. 08.11.2024, Th. 21.11.2024, Fr. 22.11.2024, Th. 05.12.2024, Fr. 06.12.2024, Th. 16.01.2025 (Exam) Rooms: TBA

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

  • Th. Nov 07, 2024: 17:15 - 19:45, Room TBA
  • Fr. Nov 08, 2024: 10:15 - 11:45, Room TBA
  • Fr. Nov 08, 2024: 12:45 - 15:15, Room TBA
  • Th. Nov 21, 2024: 17:15 - 19:45, Room TBA
  • Fr. Nov 22, 2024: 10:15 - 11:45, Room TBA
  • Fr. Nov 22, 2024: 12:45 - 15:15, Room TBA
  • Th. Dec 05, 2024: 17:15 - 19:45, Room TBA
  • Fr. Dec 06, 2024: 10:15 - 11:45, Room TBA
  • Fr. Dec 06, 2024: 12:45 - 15:15, Room TBA
  • Exam: Th. Jan 16, 2025: 17:15 - 18:00, Room TBA

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, 2nd edition, 2021