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

Idio~ma~tic Kotlin (droidcon Vienna 2019)

Marton Braun
September 20, 2019

Idio~ma~tic Kotlin (droidcon Vienna 2019)

‘Idiomatic’ is a word often used by Kotlin experts to describe elegant patterns or solutions that make excellent use of Kotlin’s features. Let’s turn this attitude around for a change, and have some fun by taking a look at the worst ways you can twist and abuse language features to take shortcuts, create tricky solutions, achieve exciting syntax, or confuse others who dare enter your codebase.

Talk recording: https://www.youtube.com/watch?v=XzBhrNq0nvQ

Marton Braun

September 20, 2019
Tweet

More Decks by Marton Braun

Other Decks in Programming

Transcript

  1. tic Kotlin
    ma
    Idio
    Márton Braun
    zsmb.co zsmb13
    [email protected]

    View full-size slide

  2. Idiotic Kotlin
    Márton Braun
    zsmb.co zsmb13
    [email protected]

    View full-size slide

  3. Odd operations

    View full-size slide

  4. https://leanpub.com/effectivekotlin

    View full-size slide

  5. https://leanpub.com/effectivekotlin

    View full-size slide

  6. https://leanpub.com/effectivekotlin

    View full-size slide

  7. https://leanpub.com/effectivekotlin

    View full-size slide

  8. https://leanpub.com/effectivekotlin

    View full-size slide

  9. https://leanpub.com/effectivekotlin

    View full-size slide

  10. https://leanpub.com/effectivekotlin

    View full-size slide

  11. https://leanpub.com/effectivekotlin

    View full-size slide

  12. https://leanpub.com/effectivekotlin

    View full-size slide

  13. https://todd.ginsberg.com/post/kotlin-random-extension/

    View full-size slide

  14. \ ツ /
    https://todd.ginsberg.com/post/kotlin-random-extension/

    View full-size slide

  15. \ ツ /
    \ ツ /
    https://todd.ginsberg.com/post/kotlin-random-extension/

    View full-size slide

  16. \ ツ /
    \ ツ /
    https://todd.ginsberg.com/post/kotlin-random-extension/

    View full-size slide

  17. \ ツ /
    \ ツ /
    \ ツ /
    https://todd.ginsberg.com/post/kotlin-random-extension/

    View full-size slide

  18. \ ツ /
    https://todd.ginsberg.com/post/kotlin-random-extension/
    \ ツ /

    View full-size slide

  19. https://todd.ginsberg.com/post/kotlin-random-extension/
    \ ツ /

    View full-size slide

  20. https://todd.ginsberg.com/post/kotlin-random-extension/
    \ ツ /

    View full-size slide

  21. https://todd.ginsberg.com/post/kotlin-random-extension/
    \ ツ /

    View full-size slide

  22. https://todd.ginsberg.com/post/kotlin-random-extension/
    \ ツ /

    View full-size slide

  23. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  24. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  25. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  26. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  27. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  28. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  29. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  30. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  31. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  32. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  33. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  34. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  35. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  36. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  37. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  38. https://zsmb.co/talks/#typical-kotlin

    View full-size slide

  39. https://medium.com/@elizarov/dealing-with-absence-of-value-307b80534903

    View full-size slide

  40. https://medium.com/@elizarov/dealing-with-absence-of-value-307b80534903

    View full-size slide

  41. https://medium.com/@elizarov/dealing-with-absence-of-value-307b80534903

    View full-size slide

  42. https://medium.com/@elizarov/dealing-with-absence-of-value-307b80534903

    View full-size slide

  43. https://medium.com/@elizarov/dealing-with-absence-of-value-307b80534903

    View full-size slide

  44. https://medium.com/@elizarov/dealing-with-absence-of-value-307b80534903

    View full-size slide

  45. Wishlist features

    View full-size slide

  46. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  47. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  48. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  49. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  50. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  51. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  52. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  53. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  54. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  55. https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/

    View full-size slide

  56. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  57. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  58. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  59. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  60. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  61. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  62. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  63. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  64. https://twitter.com/marcinmoskala/status/1007640373970329600

    View full-size slide

  65. https://stackoverflow.com/q/48037330/4465208

    View full-size slide

  66. https://stackoverflow.com/q/48037330/4465208

    View full-size slide

  67. https://stackoverflow.com/q/48037330/4465208

    View full-size slide

  68. https://stackoverflow.com/q/48037330/4465208

    View full-size slide

  69. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  70. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  71. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  72. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  73. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  74. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  75. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  76. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  77. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  78. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  79. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  80. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  81. https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  82. Sources
    • Effective Kotlin - Marcin Moskala
     https://leanpub.com/effectivekotlin
    • Abusing Kotlin's Unicode Support for Fun - Todd Ginsberg
     https://todd.ginsberg.com/post/kotlin-random-extension/
    • Typical Kotlin - Márton Braun
     https://zsmb.co/talks/#typical-kotlin
    • Dealing with the absence of value - Roman Elizarov
     https://medium.com/@elizarov/dealing-with-absence-of-value-
    307b80534903

    View full-size slide

  83. Sources
    • Reddit post - /u/Tok-A-Mak
     https://www.reddit.com/r/Kotlin/comments/cdotu0/intellectuals_will_understand/
    • Tweet - Marcin Moskala
     https://twitter.com/marcinmoskala/status/1007640373970329600
    • Stack Overflow question – Hi Lo
     https://stackoverflow.com/q/48037330/4465208
    • Stack Overflow question - cuihtlauac
     https://stackoverflow.com/q/48505963/4465208

    View full-size slide

  84. Image credits
    • First cover
     https://unsplash.com/photos/Co_hWX_XtEk
    • Second cover
     https://www.pexels.com/photo/brown-tabby-cat-lying-on-sofa-755834/
    • Questions slide
     https://unsplash.com/photos/9SWHIgu8A8k

    View full-size slide

  85. zsmb.co/talks
    zsmb13

    View full-size slide

  86. Questions?
    Márton Braun
    zsmb.co zsmb13
    [email protected]

    View full-size slide