Static final in Kotlin the right way
Published in
1 min readSep 6, 2017
Like all JAVA developer switching to Kotlin I faced a dilemma; forget about static final
variable and utility class or use companion object
. However there is third; Forget about the Class-based paradigm.
Kotlin is a multi-paradigm language, what it means that a file can contain more that one class or no class at all!! Therefore, you can store variables and functions directly in the file and import them directly where you need them.
And for my Android friend out there (Although i would recommend to use an extension):