<div dir="ltr">On 3 June 2013 18:20, Jacob Carlborg <span dir="ltr"><<a href="mailto:doob@me.com" target="_blank">doob@me.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 2013-06-03 10:11, deadalnix wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The whole concept of OOP revolve around the fact that a given class and<br>
users of the given class don't need to know about its subclasses<br>
(Liskov's substitution principle). It is subclass's responsibility to<br>
decide what it override or not, not the upper class to decide what is<br>
overriden by subclasses.<br>
<br>
If you want to create a class with customizable parts, pass parameters<br>
to the constructor. This isn't OOP what OOP is about.<br>
<br>
The performance concern is only here because things has been smashed<br>
together in a inconsequent way (as it is often done in D). In Java for<br>
instance, only overriden function are actually virtual. Everything else<br>
is finalized at link time. Which is great because you are able to<br>
override everything when testing to create mock for instance, while<br>
keeping good performance when actually running the application.<br>
</blockquote>
<br></div>
I've read a book, Effective Java, where it says, something like:<br>
<br>
If you don't intend your class to be subclassed make it final, otherwise document how to subclass and which methods to override.</blockquote><div><br></div><div style>Sounds like even they know the truth I speak, but they must enforce this by convention/documentation rather than offering strict guarantees ;)</div>
<div style>It's interesting (but not at all surprising) that C# which is much more modern decided to go the C++ way rather than the Java way.</div></div></div></div>