Droidcon Boston '19: A Dozen Techniques for Everyday DSLs
This talk exposes you to a dozen or more DSL techniques. By the end of this talk, you will have a brain full of ideas you can use to make full use of Kotlin's capabilities.
What you'll learn
You've heard all about how Kotlin supports Domain Specific Languages (DSLs) and now it is time to put Kotlin's DSL features into action in your everyday code. You may not be building the next Gradle DSL or Anko, but you are writing Kotlin code and that code can be improved using DSL techniques. Yes, this talk will cover the Kotlin features you need to write DSLs: lambdas, infix notation, @DslMarker, etc... but you need to know more than that. You need to know what your design goals should be, know how to use Kotlin's features properly to make DSLs, what design patterns help you do it, and how to evolve your code slowly into from a single improvement to eventually becoming a full DSL. This talk exposes you to a dozen or more DSL techniques. You will learn how to turn ordinary builders into languages by using design patterns such as nested builders, pass context to lambdas to make your code more language-like, swap parameter order to make your code more readable, and clean up unnecessary syntax. By the end of this talk, you will have a brain full of ideas you can use to make full use of Kotlin's capabilities.