O'Reilly logo
live online training icon Live Online training

Kotlin Next Steps: Creating DSLs

Exploiting the language capabilities of Kotlin for flexibility and fluency

Topic: Software Development
Venkat Subramaniam

Domain-specific languages (DSLs) are small, special-purpose languages used by domain experts to interact with applications or carry out particular tasks. For example, a DevOps engineer may use a DSL that helps to automate build and deployment. Whereas an external DSL is written from scratch, an internal DSL is designed on top of a host language. The more fluent and flexible a language is, the better it is to serve as a host. Kotlin—a highly flexible statically typed language—is well suited to the task.

Join expert Venkat Subramaniam to learn how to design and implement internal DSLs using Kotlin. You’ll get a quick introduction to DSLs and see why Kotlin is a good choice for implementing them, then dive deep into designing DSLs using Kotlin’s amazing facilities, employing a number of effective techniques and best practices.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • The purpose and characteristics of DSLs
  • How to design and implement internal DSLs

And you’ll be able to:

  • Design DSLs for your enterprise applications
  • Exploit the strengths of Kotlin to create highly fluent syntax
  • Provide better facilities for domain experts to interact with your enterprise applications

This training course is for you because...

  • You’re an architect, technical lead, or programmer.
  • You work with enterprise applications.
  • You want to become proficient in designing and implementing DSLs.


  • A computer with a Git client and IntelliJ IDEA Community Edition installed
  • A working knowledge of programming
  • A basic understanding of Kotlin

Recommended preparation:

Recommended follow-up:

About your instructor

  • Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., creator of agilelearner.com, co-founder of the devdotnext software conference, and an instructional professor at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly-invited speaker at several international conferences. Venkat helps his clients effectively apply and succeed with sustainable agile practices on their software projects. Venkat is a (co)author of multiple technical books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer. You can find a list of his books at agiledeveloper.com. You can reach him by email at venkats@agiledeveloper.com or on twitter at @venkat_s.


The timeframes are only estimates and may vary according to how the class is progressing

Characteristics of DSLs (55 minutes)

  • Presentation: Types of DSLs and their characteristics
  • Group discussion: Examples of DSLs
  • Hands-on exercise: Design a simple DSL for a domain-specific problem
  • Q&A

Break (5 minutes)

Designing simple DSLs (55 minutes)

  • Presentation: Using Kotlin as a host to design DSLs
  • Group discussion: How to process a DSL using Kotlin
  • Hands-on exercise: Implement a DSL using Kotlin
  • Q&A

Break (5 minutes)

Designing for fluency (55 minutes)

  • Presentation: Using Kotlin’s powerful features
  • Group discussion: Using extension functions and receivers
  • Hands-on exercise: Create fluent and expressive code
  • Q&A

Break (5 minutes)

Error handling and type safety (60 minutes)

  • Presentation: Controlling scope; error handling; failing fast
  • Group discussion: Balancing flexibility with correctness
  • Hands-on exercise: Implement error handling
  • Q&A