Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Creating Internal DSLs in Kotlin

Creating Internal DSLs in Kotlin

Creating Internal DSLs in Kotlin

More Decks by Juan Guillermo Gómez Torres

Other Decks in Programming

Transcript

  1. Juan Guillermo Gómez • Co-Leader y Co-Founder of GDG Cali.

    • Founder DevHack. • Tech Lead Wordbox • Consultant and advisor on software architecture, cloud computing and software development. • Experience in several languages and platforms. (C, C#, Java, NodeJS, android, GCP, Firebase). • Google Developer Expert GCP & Firebase • BS in System Engineering and a MS in Software Engineering. • @jggomezt
  2. ➢ Open-sourced since 2012. ➢ Developed by JetBrains. ➢ Version

    1.0 in 2016. ➢ Modern programming language ➢ Object Oriented. ➢ Statically typed. ➢ Less code with fewer bugs. ➢ Lambdas and properties. ➢ Nullable and non-nullable data type. ➢ Remove a lot of boilerplate from code. ➢ Readability. ➢ Functional constructs. ➢ Use Java Libraries. ➢ Immutability. Kotlin
  3. ➢ Computer language specialized to a particular application domain. ➢

    Contrast General Purpose Language ➢ Examples: HTML, R, SQL, VHDL ➢ BQL ---> Booking Query Language ??? Domain Specific Language
  4. ➢ External DSL vs Internal DSL ➢ Externals are implemented

    via an independent interpreter or compiler. LaTex ➢ Internals are typically implemented within a host language as a library. Domain Specific Language
  5. ➢ Context help to remove the noise. ➢ Ability to

    continue a conversation. ➢ You need fewer words you can be very expressive in a context. ➢ DLS is important to carry the context. ➢ Fluency is easy to read, it doesn’t feel like code. Context and Fluency
  6. ➢ Nature of the language is very fluent. ➢ Optional

    semicolon. Semicolons break the flow. ➢ Drop () and . using infix notation. ➢ Extensions method. ➢ Lambda -- no () for passing last lambda. ➢ Implicit receivers. Kotlin DSL Capabilities