Kotlin DSL in under an hour
summary
Shows how to turn existing Java builder classes into a readable, statically typed Kotlin DSL by live-coding a client builder that compiles and runs. Uses extension functions and properties, lambda with receiver for nested blocks, and wraps Java types with annotated Kotlin subclasses to enforce scope via @DslMarker scope control. Demonstrates IDE completion, refactoring, and compile-time checks across examples (HTML builders, Gradle Kotlin DSL, TeamCity, Ktor), and the resulting DSL compiles and behaves like normal Kotlin code.
AI-written summary · about
chapters (16)
- 0:00Intro
- 1:02What is DSL
- 3:08Examples
- 7:11Similarities
- 7:50Structure
- 9:20Transformation
- 12:58Extension Functions
- 13:33Console String
- 19:38Create Client
- 20:24Simplify Code
- 29:43Comparison
- 31:08Scope control
- 34:03DSL marker annotation
- 36:18Method invocation
- 39:08Build configuration
- 42:13Conclusion








