Jump to ratings and reviews
Rate this book

Programming DSLs in Kotlin

Rate this book
Creating your own domain-specific languages (DSLs) is both challenging and exhilarating. DSLs give users a way to interact with your applications more effectively, and Kotlin is a fantastic language to serve as a host for internal DSLs, because it greatly reduces the pain and effort of design and development. But implementing DSLs on top of Kotlin requires understanding the key strengths of the language and knowing how to apply them appropriately. Learn to avoid the pitfalls and leverage the language while creating your own elegant, fluent, concise, and robust DSLs using Kotlin.


Internal DSLs remove the burdens of implementing a full blown language compiler. The host language quickly becomes your ally to creating DSLs, but the syntax you can choose for your DSLs is limited to what the host language allows. You can work around the limitations by tactfully bending the rules and exploiting the language capabilities. Learn the power of Kotlin and ways to design with it, in the context of crafting internal DSLs


Start by learning ways to exploit the flexibilities of Kotlin to make your DSLs fluent, expressive, and concise. Then pick up techniques to extend the language with domain specific properties and functions. Quickly move ahead to tie your DSL snippets into the runtime environment and context of execution of your applications. Design to prevent any non-sensical syntax in your DSL that may otherwise be valid in the host language. Finally, learn techniques to gracefully handle errors. Practice using the multiple examples that are included in each chapter.


Fire up your editor and follow along each example to become proficient in designing and implementing your own internal DSLs using Kotlin.


What You


Kotlin version 1.3 or later and your favorite Kotlin IDE or code editor.

126 pages, Kindle Edition

Published March 23, 2021

1 person is currently reading
6 people want to read

About the author

Venkat Subramaniam

21 books71 followers
Dr. Venkat Subramaniam, founder of Agile Developer, Inc., has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia. Venkat helps his clients effectively apply and succeed with agile practices on their software projects. He is a frequent invited speaker at international software conferences and user groups. He's author of .NET Gotchas (O'Reilly), coauthor of the 2007 Jolt Productivity award-winning book Practices of an Agile Developer (Pragmatic Bookshelf), and author of Programming Groovy (Pragmatic Bookshelf).

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
3 (27%)
4 stars
6 (54%)
3 stars
2 (18%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 2 of 2 reviews
35 reviews6 followers
September 22, 2020
Good introduction to DSLs and the challenges one will encounter. This was the beta 1.0 version, I’ll wait for the completion of the book and update my review accordingly.
Displaying 1 - 2 of 2 reviews

Can't find what you're looking for?

Get help and learn more about the design.