[jdom-interest] Request -- please allow all XML 1.1 conformant text in Element.se tText()

Chris B. chris at tech.com.au
Sun Mar 7 18:12:13 PST 2004


Elliotte Rusty Harold wrote:

> Have you read Meyer? 


Yes.

> If you have, you have severely misunderstood him at a very basic level. 


Wrong.

> In Eiffel (and in Meyer's general philosophy of object oriented 
> programming) "the invariants of all the parents of a class apply to 
> the class itself" (OOSC, p. 570). In other words, an overriding method 
> must satisfy the postconditions of the overridden method. This is 
> trickier in Java than Eiffel because Java doesn't have inheritable 
> postconditions. 


The fact that Java lacks a suitable class invariant and precondition 
feature, does not alter the fact that Meyer's open-closed principle, and 
his design of the Eiffel language is intended never to prevent 
inheritance and redefinition of methods, provided of course you don't 
violate the invariants and preconditions. If the invariant is something 
along the lines of "this is a valid JDOM tree" then you are always free 
to inherit and redefine a method so that you guarantee the invariant 
using a different algorithm - e.g. because you KNOW it is valid because 
of some other reason.

In other words - Yes - when you inherit you must conform to the 
semantics of the original class, but No, you shouldn't be telling 
somebody else when and how you must conform to your class. The fact that 
Java lacks a proper method of forcing subclasses to conform does not 
alter the fact that it is not your job to stop them inheriting and 
re-defining.

> But even Eiffel also offers the ability to freeze a feature, roughly 
> equivalent to Java's final. 


Does it? I am only familiar with the compiler Freeze feature, which has 
nothing to do with the language, and I can't find any "feature freeze". 
But then again its a while since I programmed Eiffel.

> Meyer certainly does not recommend allowing subclasses unrestricted 
> redefinition of superclass functionality, just the opposite in fact.
>
> Also, can you give a page cite for that quote? I couldn't find it.


It is not a citation from Meyer.







More information about the jdom-interest mailing list