Classes final by default

Yeah… I am for “Open by Default”, too.
Just consider working with legacy code. Did you ever had to null out a function, where the function did some database transactions? Or trying to reach the network?
So I don’t want to touch the legacy code for now. The technique with inheritance is very common where I override the problematic function and then I can get the class easier into test. Kotlin is in this situation more invasive because I have to declare the class as open and the specific function, too.

These are no new arguments. Like with almost all technical decisions there are upsides and downsides … and a lot of personal taste. I can not see that this discussion would ever come to an end.

3 Likes

I beg all library developers to mark all their kotlin public classes and methods as open. It will make for a much healthier ecosystem.

Could this topic please be closed? Every new post is boring repetition without bringing anything new to the topic. The discussion is not about facts (anymore), but about opinions.

3 Likes