Slow performance compared to C++, ideas?

Paulo Pinto pjmlp at progtools.org
Mon Jun 3 10:45:01 PDT 2013


Am 03.06.2013 18:19, schrieb Manu:
> On 3 June 2013 18:20, Jacob Carlborg <doob at me.com <mailto: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.

C# just followed the Object Pascal/Delphi model, which is based in C++. 
That's why.

You have to thank Anders for it.

--
Paulo


More information about the Digitalmars-d mailing list