next level dsls
play

Next Level DSLs Configure your app the Kotlin way! Aaron Sarazan - PowerPoint PPT Presentation

Next Level DSLs Configure your app the Kotlin way! Aaron Sarazan CTO - Stencil Ltd. https://gitlab.com/asarazan/kotlinconf18 aaron@stencil.ltd Isolated Feature Development A Plugin Its like an app, just smaller Android Manifest Plugin


  1. Next Level DSLs Configure your app the Kotlin way! Aaron Sarazan CTO - Stencil Ltd. https://gitlab.com/asarazan/kotlinconf18 aaron@stencil.ltd

  2. Isolated Feature Development

  3. A Plugin It’s like an app, just smaller

  4. Android Manifest

  5. Plugin DSL

  6. Plugin DSL

  7. Plugin DSL

  8. Plugin DSL

  9. Plugin DSL

  10. Back to Basics

  11. Help! What’s a DSL?

  12. When you really wish your language could do the thing.

  13. Help! What’s a DSL? Java

  14. Help! What’s a DSL? LISP

  15. Help! What’s a DSL? Ruby

  16. Podfiles

  17. Help! What’s a DSL? Domain Specific Language

  18. white space

  19. Remove Boilerplate

  20. Help! What’s a DSL? Domain Specific Language

  21. Help! What’s a DSL? Domain Specific Language

  22. Help! What’s a DSL? Domain Specific Language

  23. Help! What’s a DSL? Domain Specific Language

  24. You don’t DO the thing. You STATE the thing.

  25. GRADLE!

  26. Here’s How It Works

  27. Here’s How It Works

  28. Here’s How It Works

  29. Experience Get!

  30. Why Kotlin?

  31. Groovy-Style Type-Safe Builders

  32. It was literally built for it. Kotlin is made for DSLs

  33. When Should I Make a DSL?

  34. Anko

  35. Anko

  36. Anko

  37. ● XML This is Really Unpleasant ● Configuration ● Declaration ...and there has to be a better way. ● Boilerplate ● Builders

  38. Builders ALWAYS a candidate for DSLs

  39. Readability

  40. Work Backwards Start from the result that you want to enable ...then write the code that enables it!

  41. Start With Builders Immutability with a side of Java-friendliness!

  42. @DslMarker Prevent Scoping Mishaps!

  43. Don’t pollute the global namespace ● Good Hygiene Unary “+” only if well-scoped ● Keep Lambda files next to your builder classes ● Plugin.kt ○ PluginLambdas.kt ○ Don’t extend system types ● String, Int, etc. ○

  44. Don’t pollute the global namespace ● Unary “+” only if well-scoped ● Good Hygiene Keep Lambda files next to your builder classes ● Plugin.kt ○ PluginLambdas.kt ○ Don’t extend system types ● String, Int, etc. ○ Have fun! ●

  45. So Who’s Ready?

  46. Follow Along At Home ● https://gitlab.com/asarazan/kotlinconf18

  47. Thank You aaron@stencil.ltd https://gitlab.com/asarazan/kotlinconf18

  48. DSLs 1 EVERYWHERE

  49. Kotlin’s Strongest Metaphors Applied to Java’s biggest bummers

  50. How Did We Get Here?

  51. Value Types & Structs!!!

  52. Next Level DSLs Configure your app the Kotlin way! Aaron Sarazan CTO - Stencil Ltd. https://gitlab.com/asarazan/kotlinconf18 aaron@stencil.ltd

  53. How About That Keynote? I can’t wait to get home and try out {AWESOME NEW FEATURE}

  54. Next Level DSLs Configure your app the Kotlin way! Aaron Sarazan CTO - Stencil Ltd. https://gitlab.com/asarazan/kotlinconf18 aaron@stencil.ltd

  55. Follow Along At Home ● https://gitlab.com/asarazan/kotlinconf18

  56. Why Kotlin?

Recommend


More recommend