Slow performance compared to C++, ideas?

Manu turkeyman at gmail.com
Mon Jun 3 09:19:12 PDT 2013


On 3 June 2013 18:20, Jacob Carlborg <doob at me.com> wrote:

> 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.


Sounds like even they know the truth I speak, but they must enforce this by
convention/documentation rather than offering strict guarantees ;)
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130604/d905f439/attachment.html>


More information about the Digitalmars-d mailing list