I actually don't feel final by default is a big deal at all. Of all the factors that caused the poor performance that was discussed in the original post, final is the least significant one, only caused 5% to %7 of a speed penalty in a heavily recursive and looping program. Because of this I think its effect in less demanding scenario is negligible. Those who really needs the extra speed can simply add final to their methods in the hot path.

On Saturday, 1 June 2013 at 06:35:38 UTC, Paulo Pinto wrote:
In OO languages where methods are virtual by default, writing mock classes is usually a matter of extending and overriding said classes.

In languages with final by default, one is forced to use Assembly or bytecode rewriting tools to be able to override those classes behaviour.

In .NET case the Moles/Pex frameworks from Microsoft research were so loved by developers that Microsoft made it part of .NET 4.5 under the name Fake framework.

The same for the C++ with frameworks like Isolator++.

Of course with virtual by default it is also possible to make a method or class as final, thus causing the same issues with mocking as final by
default does.

Just my .02€ input to the discussion.

--
Paulo

Reply via email to