Stage 1
Stage 1: Foundation
✅ Complete. Every part below has its full lesson (
README.md),examples/,exercises.mdandsolutions/, 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 small, real Kotlin programs on your own — calculators, menus, a shopping cart, a file-based tool — without reaching for
!!or copying Java habits that don't fit Kotlin. Time: about 6 weeks at 1–1.5 hours a day (~43–45 hours including the project) · Level: comfortable in at least one other language; no prior Kotlin or JVM experience assumed.
Prerequisites
- A computer that can run
kotlinc(verified on this machine — see../TOOLING.md). - Comfort with some language's basics: variables, if/else, loops, functions. This stage teaches Kotlin's version of those, not programming from zero.
- No Android Studio, no Gradle, no third-party library needed for this entire stage — deliberately,
so you aren't fighting a build tool and a new language at the same time. Gradle enters in
Stage 2, Part 11 (see
../DESIGN-NOTES.mdfor why).
Parts in this stage
Do them in order. Null safety (Part 3) is pulled forward deliberately, ahead of control
flow — see ../DESIGN-NOTES.md for the reasoning.
| Part | Topic | Learning outcomes | You will build | Time |
|---|---|---|---|---|
| 1 | How Kotlin runs | Install JDK + Kotlin; tell apart kotlinc (compile), the Kotlin script runner, and the Kotlin REPL; what a .kt file becomes on the JVM, in plain terms |
"Hello, Kotlin" banner | ~3 h |
| 2 | Language fundamentals | val vs var, built-in types, type inference, string templates, arithmetic/comparison/logical operators, explicit casting (toInt(), as) |
Restaurant bill splitter | ~5 h |
| 3 | Null safety | Nullable types (String?), safe call ?., Elvis ?:, !! and why to avoid it, lateinit vs lazy, what a "platform type" from Java looks like |
Safe user-profile lookup with no !! |
~4 h |
| 4 | Control flow | if/when as expressions (not just statements), for over ranges and collections, while/do-while, labeled break/continue |
ATM menu with 3 PIN attempts | ~4 h |
| 5 | Functions | fun declarations, default and named arguments, vararg, single-expression functions, local functions, lambdas as values (just enough to pass one around) |
Discount calculator | ~5 h |
| 6 | Collections | List/Set/Map, mutable vs read-only collection interfaces, arrays vs lists, destructuring declarations, basic for/index access |
Shopping cart | ~5 h |
| 7 | Classes and objects | class, primary and secondary constructors, properties with custom getters/setters, init blocks, visibility modifiers (public/private/internal) |
Bank account (single class) | ~6 h |
| 8 | Files, text and data formats | File I/O with File/use {}, reading/writing text, basic string parsing (splitting a line into fields by hand — no JSON library yet) |
To-do list saved to a text file; simple log parser | ~5 h |
| 🏁 | Project: Expense tracker | A complete command-line app using Parts 2–8 | ~6–8 h | — |
How every part will be organised (once content lands)
part-NN-topic/
├── README.md ← 1. read the lesson
├── examples/ ← 2. run the example programs with kotlinc
├── exercises.md ← 3. solve the practice questions yourself
└── solutions/ ← 4. only then compare with the solution
How the code will run
Every Stage 1 example is plain Kotlin with no third-party dependency and no Gradle project — just:
kotlinc examples/06_bill_splitter.kt -include-runtime -d bill_splitter.jar
java -jar bill_splitter.jar
This is the exact compile/run pattern already verified end-to-end for a Hello World in
../TOOLING.md; Stage 1 content will reuse it for every example.
Stage 1 checklist (once content lands)
- Parts 1–8 done, with every exercise attempted
- Expense tracker project built and working
- Every example was actually compiled and run, not just read
Next: 🟡 Stage 2: Intermediate (OOP in depth, functional Kotlin, Gradle, testing, Java interop)