C# -- the Java killer?
Maurizio De Cecco
maurizio@mandrakesoft.com
Thu Jun 29 02:50:00 GMT 2000
Godmar Back <gback@cs.utah.edu> writes:
> Actually, this choice is something I very much agree with.
> I think that Java got it wrong when it made "virtual" the default.
> The performance issues you mention are the least of my concerns.
>> The primary problem is that virtual methods are error-prone. They
> can easily break base classes if a subclass that overrides a method
> does not implement the contract of the overridden method 100%, which
> frequently happens.
Well, this is equivalent to say inheritance in OO programming is error prone;
this is true, as all the mechanisms that are not used with enough discipline.
As an old time OO programmer (my first programming language was the Symbolics Lisp
Machine Flavors/Zlisp system), i find non-virtual method as error prone; if genericity
is your programming style, having exception to genericity is error prone as well.
> Especially in closed-source (or bytecode only)
> base systems where you extend classes in the "programming by difference"
> paradigm such mistakes are hard to impossible to track down.
I would say that the problem is not in the language mechanism, but in
this kind of programming style, where you are actually playing around
with non-documented or complex interfaces.
>From this point of view i find the "final" keyword semantically more
clear, because it express directly the protection against unwanted
specialization of method, generating an explicit compilation error
instead of just producing a different semantic ...
Finally, i think it is more a matter of programming culture: we notice
more the differences w.r.t. our existing culture; personally, coming
from non typed, dynamic OO languages i always considered the virtual
keyword as annoying :-> ...
Maurizio
--
Maurizio De Cecco
MandrakeSoft http://www.mandrakesoft.com/
More information about the Java
mailing list