Stage 2

Stage 2: Intermediate

✅ Complete. Every part below has its full lesson (README.md), examples/, exercises.md and solutions/, and every program was compiled and run on the toolchain recorded in ../TOOLING.md (kotlinc 2.4.21, JDK 21) — see each part's README for real, captured output.

Goal: Write idiomatic, well-organized Kotlin: real class hierarchies, functional-style data transforms, a proper Gradle build with tests, and enough Java interop to not be surprised by it on a real JVM team. Time: about 6 weeks at 1–1.5 hours a day (~30 hours including the project) · Level: finished Stage 1, including the null-safety and classes parts.


Prerequisites

Parts in this stage

Part Topic Learning outcomes You will build Time
9 Object-oriented Kotlin in depth Inheritance and override, interfaces with default methods, abstract class, sealed class/sealed interface, data class (and what it generates for you), enum class, object/companion object, writing equals/hashCode/toString by hand once before letting data class do it Bank account system: hierarchy of account types, sealed result types for transactions ~7 h
10 Functional Kotlin Higher-order functions and function types, extension functions, scope functions (let, run, with, apply, also) and when to reach for each, Sequence vs eagerly-evaluated collections, operator overloading A small report pipeline: filter → transform → summarize a list of transactions ~6 h
11 Build tooling and testing Gradle basics with the Kotlin DSL (build.gradle.kts), adding a test dependency, kotlin.test/JUnit5, running tests from the command line, ktlint/detekt as linters, using a debugger/breakpoint-equivalent in an IDE A Gradle-built module with real unit tests for the discount function from Stage 1 ~4 h
12 Java interop and the JVM ecosystem Platform types (String!) when calling Java, @JvmStatic/@JvmOverloads/@JvmField, calling a Java library from Kotlin, calling a Kotlin class from Java, what "the JVM ecosystem" buys you (Maven Central, existing Java libraries) Call a small Java utility class from Kotlin, and expose a Kotlin class cleanly to Java ~5 h
🏁 Project: Library management system Books, members and loans modeled with Part 9's OOP toolkit, built as a Gradle module with tests from Part 11 ~8 h —

How every part will be organised (once content lands)

Same layout as Stage 1 (README.md, examples/, exercises.md, solutions/), except from Part 11 onward the examples/ folder is itself a small Gradle project rather than loose .kt files, since that's the point being taught.

How the code will run

Parts 9–10: same kotlinc -include-runtime -d x.jar && java -jar x.jar pattern as Stage 1. Parts 11–12 onward: ./gradlew build / ./gradlew test, run from inside that part's Gradle project. The content wave must verify the first Gradle-based example with real network access (Maven Central dependency resolution) before publishing — flagged in ../TOOLING.md.


Stage 2 checklist (once content lands)

Next: 🔴 Stage 3: Advanced (generics, coroutines, internals, packaging)

Search the guide