Building a DSL... In Kotlin

Building a DSL... In Kotlin

Kotlin is a multipurpose language that makes building domain-specific languages (DSLs) a breeze. But, what is a DSL? A domain-specific language is a small programming dictionary designed specifically to express solutions to problems focused on a particular aspect of a software system. There are a lot of them around, like CSS for styling, HTML for websites, and SQL for querying databases. A well-designed DSL is much easier to program with than a traditional library. This is just one of the nice things about DSLs. Let me show you how I built one in Kotlin.

In this session we will learn how to design a DSL and understand why we should use Functional Programming (FP) and Kotlin to build one. We will analyze Do’s and Don’ts from my experience creating a UI Automator-gesture generation DSL (https://github.com/Guardiola31337/uiagesturegen). Along with Kotlin's power and DSL building facilities, we will explore how we can make this DSL entirely stack safe, composable and reusable under different runtime requirements thanks to KΛTEGORY (https://github.com/kategory/kategory), a library which provides abstractions for FP in Kotlin.

By the end of the talk, you will be itching to write your own!

3c2bdd16c0ea8511dc254b8497a06f78?s=128

Pablo Guardiola

November 07, 2017
Tweet