4/4/2026 at 6:07:58 AM
> Make all of your leaf classes final. After all, you're done with the project - certainly no one else could possibly improve on your work by extending your classes.It's actually a good advice. A class not designed to be extendable should be marked as final.
by Panzerschrek
4/4/2026 at 1:22:28 PM
Especially since it takes like 2 seconds to make said classes unfinal and there are no negative consequences of doing this.But 1999, that was peak "inheritance is how we fix everything" thinking.
About the only reason to not do this is if you are writing a library. Even then, it's better to make extensions available through things like closures (not really available in 1999).
by cogman10
4/4/2026 at 8:31:02 PM
In fact, I'd go so far as to say that classes not being final or sealed (C#) by default is another failure to set sensible defaults, akin to "everything is mutable unless explicitly marked const".Properly designing classes for inheritance takes proactive care and is, in my experience, almost never done unless the author has been forced to by external forces (through APIs or agreements with other developers).
by btschaegg