Slow performance compared to C++, ideas?

Jacob Carlborg doob at me.com
Mon Jun 3 01:20:39 PDT 2013


On 2013-06-03 10:11, deadalnix wrote:

> The whole concept of OOP revolve around the fact that a given class and
> users of the given class don't need to know about its subclasses
> (Liskov's substitution principle). It is subclass's responsibility to
> decide what it override or not, not the upper class to decide what is
> overriden by subclasses.
>
> If you want to create a class with customizable parts, pass parameters
> to the constructor. This isn't OOP what OOP is about.
>
> The performance concern is only here because things has been smashed
> together in a inconsequent way (as it is often done in D). In Java for
> instance, only overriden function are actually virtual. Everything else
> is finalized at link time. Which is great because you are able to
> override everything when testing to create mock for instance, while
> keeping good performance when actually running the application.

I've read a book, Effective Java, where it says, something like:

If you don't intend your class to be subclassed make it final, otherwise 
document how to subclass and which methods to override.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list