![]() ![]() If overused, they can make our code even harder to read. Moreover, some Kotlin features should be used with sound judgment. Let’s see how we can write idiomatic Kotlin code and do things the Kotlin way.Ī word of warning: The following list is not exhaustive and does only express my humble opinion. Many of them can be replaced with better alternatives that are provided by Kotlin. In order to take full advantage of Kotlin, we have to revisit some best practices we got used to in Java. object for Stateless Interface Implementations.Refer to Constructor Parameters in Property Initializers.Concise Mapping with Single Expression Functions.apply() for Grouping Object Initialization.Named Arguments instead of Fluent Setter.Top-Level (Extension) Functions for Utility Functions.Kotlin’s Built-in Support for Common Java Idioms and Patterns.Java Ecosystem, Kotlin, Engineering Management, Sociology of Software Development Idiomatic Kotlin. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |