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

Take your Kotlin to the next step, abandon what you’ve learned (in Java)

Take your Kotlin to the next step, abandon what you’ve learned (in Java)

Often Kotlin developers have a Java background. For many of us, that is actually the reason why we love Kotlin so much.

But although we know and like the new features Kotlin gives us, we often hold on to concepts from the Java world. What’s once learned is not easily forgotten. To go Kotlin all the way, we need to unlearn some of those things. But how do we actually learn things and can unlearn what we need to? Let's dive all the way into Kotlin spiced with a bit of Neuroscience.

Danny Preussler

October 17, 2020
Tweet

More Decks by Danny Preussler

Other Decks in Technology

Transcript

  1. Embrace change
    Abandon what you’ve learned
    @PreusslerBerlin

    View Slide

  2. https://www.thecut.com/2018/01/how-to-conquer-your-fear-of-trying-new-things.html
    From an evolutionary
    standpoint, trying new things,
    for much of human history,
    could have been dangerous

    View Slide

  3. Dean Burnett, Neuroscientist, author
    We have a threat-detection system
    that [..] tags anything unusual or
    unknown [..],
    That's what's kept us alive for
    millions of years

    View Slide

  4. MINDSETS

    View Slide

  5. fixed-mindset
    prevent them from evolving in
    the acquisition of skills …
    outside their comfort zone.
    “Mindset”, Dr. Carol Dweck

    View Slide

  6. growth-mindset
    certain amount of curiosity,
    ease and perseverance in
    solving difficult problems
    “Mindset”, Dr. Carol Dweck

    View Slide

  7. View Slide

  8. View Slide

  9. we learn new knowledge by reference
    to those we already know.
    We focus on the points of similarity
    between them to select the information
    that reaches the brain.
    http://www.anewya.co.in/why-learn-unlearn-relearn

    View Slide

  10. View Slide

  11. What got you here won’t get
    you there.
    Book title by Marshall Goldsmith

    View Slide

  12. © Christina Lee, KotlinConf 2019

    View Slide

  13. It is not the strongest of the species
    that survives,
    not the most intelligent [..]
    It is the one that is the most
    adaptable to change.
    Charles Darwin

    View Slide

  14. Pascal

    View Slide

  15. C/C++

    View Slide

  16. Java

    View Slide

  17. Kotlin

    View Slide

  18. The illiterate of the 21st century
    will not be those
    who cannot read and write,
    but those who cannot
    learn, unlearn, and relearn.
    Alvin Toffler, Author, Futurist

    View Slide

  19. CONSTANTS

    View Slide

  20. Constants
    In Java: static final In Kotlin: const val
    But where?

    View Slide

  21. Constants

    View Slide

  22. Constants

    View Slide

  23. Constants

    View Slide

  24. Constants

    View Slide

  25. https://twitter.com/PreusslerBerlin/status/1305565623867633666
    Constants

    View Slide

  26. TIME TO UNLEARN

    View Slide

  27. .. is not about forgetting.
    It’s about the ability to choose
    an alternative mental model or
    paradigm.
    https://hbr.org/2016/11/why-the-problem-with-learning-is-unlearning

    View Slide

  28. The process of unlearning:
    1.) Recognize that the old mental model
    is no longer relevant or effective.
    This is a challenge because we are
    usually unconscious of our mental
    models
    https://hbr.org/2016/11/why-the-problem-with-learning-is-unlearning

    View Slide

  29. The process of unlearning:
    2.) Find or create a new model
    that can better achieve your goals.
    Careful, you will probably
    see this new model through
    the lens of the old.
    https://hbr.org/2016/11/why-the-problem-with-learning-is-unlearning

    View Slide

  30. The process of unlearning:
    3.) Ingrain the new mental habits
    https://hbr.org/2016/11/why-the-problem-with-learning-is-unlearning

    View Slide

  31. GET FUNCTIONAL

    View Slide

  32. Get functional

    View Slide

  33. Get functional

    View Slide

  34. The tools we use have a
    profound (and devious)
    influence on our thinking
    habits, and, therefore, on our
    thinking abilities.
    Edsger W. Dijkstra

    View Slide

  35. OPERATORS

    View Slide

  36. Operators
    Thinking of … ?
    a + b a.plus(b)
    a > b a.compareTo(b) > 0
    a in b b.contains(a)
    a..b a.rangeTo(b)

    View Slide

  37. Operators

    View Slide

  38. Operators

    View Slide

  39. Operators

    View Slide

  40. Developing an original and creative idea
    requires the simultaneous activation
    of two [..]
    perhaps even contradictory --
    networks
    University of Haifa 2015
    https://www.sciencedaily.com/releases/2015/11/151119104105.htm

    View Slide

  41. WHAT GOES ON
    IN THE MINDS
    OF PROGRAMMERS WHEN
    THEY READ CODE?

    View Slide

  42. Understanding Understanding Source Code with Functional Magnetic
    Resonance Imaging
    University of Passau, University of Magdeburg, Carnegie Mellon, Georgia Tech, Leibniz Institute for
    Neurobiology, Metop Research Institute, 2014
    http://www.cs.cmu.edu/~ckaestne/pdf/icse14_fmri.pdf
    Studying programming in the neuroage: just a crazy idea?
    Chemnitz University of Technology, 2020
    https://dl.acm.org/doi/10.1145/3347093
    Studies

    View Slide

  43. To our surprise, we could not
    observe any activity in the
    direction of mathematical or
    logical thinking, ...
    https://medicalxpress.com/news/2020-06-language-brain-scans-reveal-coding.html

    View Slide

  44. The image data clearly
    showed activation in the test
    subjects' left brain areas,
    which are mainly associated
    with speech comprehension.
    https://medicalxpress.com/news/2020-06-language-brain-scans-reveal-coding.html

    View Slide

  45. NAMES

    View Slide

  46. COBOL variable names [..] can
    use any of the uppercase
    alphabet characters, the digits 0
    through 9, and the hyphen (but
    not as a starting character).

    View Slide

  47. Kotlin
    Something inside us
    cringe

    View Slide

  48. social missteps
    activate regions in the brain, [..]
    that have been previously
    associated with physical pain.
    University of Michigan, University of Colorado, Boulder, Columbia
    University, New York Psychiatric Institute,
    https://sciencephenomena.wordpress.com/2015/05/10/the-neurological-aspect-of-cringing/

    View Slide

  49. When people express opinions that
    differ from yours,
    take it as a chance to grow.
    Be curious, not defensive.
    http://www.anewya.co.in/why-learn-unlearn-relearn

    View Slide

  50. Practicing unlearning
    will make it easier and quicker
    to make the shifts
    as your brain adapts.
    https://hbr.org/2016/11/why-the-problem-with-learning-is-unlearning

    View Slide

  51. PROPERTIES

    View Slide

  52. Properties

    View Slide

  53. Properties

    View Slide

  54. Properties

    View Slide

  55. Properties

    View Slide

  56. Properties

    View Slide

  57. Properties

    View Slide

  58. Properties

    View Slide

  59. DELEGATES

    View Slide

  60. Property Delegates

    View Slide

  61. Property Delegates

    View Slide

  62. Property Delegates

    View Slide

  63. Property Delegates

    View Slide

  64. Property Delegates

    View Slide

  65. Property Delegates

    View Slide

  66. Property Delegates

    View Slide

  67. Property Delegates

    View Slide

  68. Property Delegates

    View Slide

  69. Property Delegates

    View Slide

  70. Property Delegates

    View Slide

  71. Property Delegates

    View Slide

  72. Property Delegates

    View Slide

  73. Property Delegates

    View Slide

  74. EXTENSION FUNCTIONS

    View Slide

  75. Extension functions

    View Slide

  76. Extension functions

    View Slide

  77. Conceptual Affinity.
    Certain bits of code want to be near
    other bits. They have a certain
    conceptual affinity.
    The stronger that affinity, the less
    vertical distance there should be
    between them.
    (Clean Code, Robert Martin)

    View Slide

  78. Extension functions

    View Slide

  79. Extension functions

    View Slide

  80. Extension functions

    View Slide

  81. Property Delegates

    View Slide

  82. Property Delegates

    View Slide

  83. Think outside the box!

    View Slide

  84. Think outside the box!?

    View Slide

  85. When you look at the neuroscience of
    creativity, you see that it’s physically
    impossible for your brain to
    “Think outside the box.”
    http://www.jaredvolle.com/why-thinking-outside-the-box-is-completely-wrong/

    View Slide

  86. That’s simply not how the brain is wired.
    It’s like asking your brain
    to fire a neuron
    that doesn’t exist.
    http://www.jaredvolle.com/why-thinking-outside-the-box-is-completely-wrong/

    View Slide

  87. There is nothing
    outside of “the box”
    except for more boxes.
    [..] the trick is
    to think between boxes.
    http://www.jaredvolle.com/why-thinking-outside-the-box-is-completely-wrong/

    View Slide

  88. GENERICS

    View Slide

  89. Generics
    ● Kotlin generics offer some new changes
    ● Don’t be afraid if reified syntax

    View Slide

  90. Generics

    View Slide

  91. Generics

    View Slide

  92. Generics

    View Slide

  93. Generics

    View Slide

  94. HOW TO GET THERE?

    View Slide

  95. Habits
    ● Habits are the brain’s internal drivers
    ● brain forms neuronal connections based on what you do repeatedly in
    your life — both good and bad.
    ● Every time you act in the same way, a specific neuronal pattern is
    stimulated and becomes strengthened in your brain.

    View Slide

  96. View Slide

  97. How to get there
    - Unlearn: build new models w/o looking through old lenses
    - Connect the boxes
    - Practise
    - Change habits

    View Slide

  98. Nothing so needs reforming
    as other people’s habits
    Mark Twain

    View Slide

  99. You tell me, I forget.
    You teach me, I remember.
    You involve me, I learn
    Benjamin Franklin

    View Slide

  100. When your brain expects a
    reward even [..], you are more
    likely to pursue the new
    routine and stick to it.
    https://medium.com/swlh/to-break-bad-habits-you-really-have-to-change-your-brain-the-neurosci
    ence-of-change-da735de9afdf

    View Slide

  101. View Slide

  102. View Slide

  103. Thank you
    ● World’s largest open audio platform
    ● Founded in 2007
    ● 200 million tracks, 25 million creators
    ● What’s next in music is first on SoundCloud

    View Slide

  104. Further reads
    ● https://medicalxpress.com/news/2020-06-language-brain-scans-reveal-coding.html
    ● https://www.makeuseof.com/tag/how-programming-affects-brain/
    ● https://medium.com/swlh/to-break-bad-habits-you-really-have-to-change-your-brain-the-neuroscience-of-chang
    e-da735de9afdf
    ● https://www.sciencedaily.com/releases/2015/11/151119104105.htm
    ● http://www.jaredvolle.com/why-thinking-outside-the-box-is-completely-wrong/
    ● https://www.thecut.com/2018/01/how-to-conquer-your-fear-of-trying-new-things.html
    ● https://hbr.org/2016/11/why-the-problem-with-learning-is-unlearning
    ● https://thriveglobal.com/stories/unlearning-to-learn/
    ● https://proandroiddev.com/keep-your-interfaces-simple-e025d515e3b9
    ● https://www.youtube.com/playlist?list=PLQ176FUIyIUY6SKGl3Cj9yeYibBuRr3Hl&app=desktop

    View Slide

  105. Thank you
    @PreusslerBerlin

    View Slide