Daniil Vodopian
Jul 30, 2017 · 1 min read

Great post, but I totally disagree with the usage of apply.

Early returns are very common in Kotlin, and the syntax is optimized for them. For example, your situation can be rewritten like `val percentComplete = player?.playPercentage ?: return`, which is readable and concise.

More over, what’s the point of introducing player as this, if you only need it for one property? let or run would do the job. IMHO your final version is overcomplicated because of the apply usage.