Classes final by default

For what it's worth, my vote is for "Open by default".

Too often in Java I’ve been crippled by a library which I wanted to modify but couldn’t because the author had declared classes final. It’s not the default in Java and even then, this caused me a lot of grief. I can envision this situation becoming much worse in Kotlin with the default being closed classes.

The ability to extend classes in ways the original authors never envisioned far outweighs the (extremely rare) case where you break the class by extending it, a concern that is largely theoretical and hardly ever happens in practice in my experience.

12 Likes