The Golden Hammer, a.k.a Law of the Instrument, a.k.a. Maslow's Hammer is "a cognitive bias that involves an over-reliance on a familiar tool." (Wikipedia)
You might be familiar with it phrased by Abraham Maslow in this way (hence the name "Maslow's Hammer"):
I suppose it is tempting, if the only tool you have is a hammer to treat everything as if it were a nail.
After three years of developing with Kotlin, I know a couple of things for sure. That I still love Kotlin and that I am still figuring out what idiomatic and "good" Kotlin is.
Looking for an answer to "what is idiomatic Kotlin?" I first tried to learn as much as I could about as many Kotlin features as I could. I wrote a talk called "Dissecting the stdlib," where I (super quickly) went through many of the Kotlin features and stdlib tools that I loved. Moreover, these were features that felt pretty Kotlin-y to me.
Learning syntax and getting exposure to features is always a great place to start. In my effort to be Kotlin-y and idiomatic by using as much Kotlin as I could, I sometimes wrote code that made me mentally jump through hoops. I sometimes wrote code that I didn't understand six months later, either in a literal "what am I doing here?" way but also in an "I don't know/remember why I did things this way." way. I often fell in love with Kotlin features and became biased towards using them to the point of over-using them, because I had a hammer and I was going to use it on all my Kotlin nails.
Read More