Post

I love Kotlin but please don't abuse its features. I regularly see code like in the first function when you can instead write a simple if statement: it's shorter, easier to read, and doesn't allocate an object! Thankfully both functions compile to the same assembly when R8 is turned on.

My own pet peeve is when folks use `?.let {} ?:` instead of if/else when checking null It's less readable, and more error prone (because if "doThing()" accidentally returns null, then you end up running the ?: branch, which often is not what you actually want.

OMG I hate this. And people are like "this is idiomatic" kotlin. I used to link them to @jakewhartons tweet about it. But you should write a blog post about this so I can point people to it in code review when people tell me to use let. I already link them to your tweet regarding let, apply, etc

No replies yet.