To say that OO techniques only apply to behavior is an oversimplication.
Some of the basic tenets of OO (encapsulation, polymorphism) are only
applicable when behavior is modelled, but I would maintain that others
(inheritance, identity) are equally applicable to data. The two last
examples would both be of huge benefit to XML and are both currently
lacking.
Eliot Kimber indicated some scepticism as to whether OO techniques have
really lived up to their hype. In terms of a controlled environment, they
have. Any C programmer who has moved onto C++ will attest that OO features
make it far easier to write extensible and maintainable code. On the other
hand, the promise that this would lead to interchangeable components that
could be used anywhere has clearly been a flop. Why? For exactly the reason
Tim mentioned in his mail: interoperable APIs never work. You can't
interface with code and expect this interface to apply to any environment
other than the one it was specifically designed for. This is the case
whatever technology you are using (DLLs, Java, JavaBeans, Smalltalk, COM,
CORBA, etc.). Hence XML.
Nevertheless, inheritance of some sort is absolutely vital if XML is to
fulfill its promise. If we can't produce standard DTDs which can be
extended, *without* modifying the base DTD, then many of the advantages of
XML go out the window. This is as important as, say, linking facilities, and
is certainly orthogonal to the current namespace proposal.
I have been giving quite a lot of thought to how inheritance (I don't really
think sub-typing is the right term) could be implemented for XML. I'll have
to write up the details in a seperate document, as this mail is getting
pretty long. In essence:
1) HyTime provides an extremely valuable and rich basis for this work, just
as it has for XML-Link. However, the relevant aspects need to be extracted
and presented in a more easily digestible form. Also, HyTime attempts to
implement inheritance (of element content) without extending the DTD syntax.
This decision should at least be reevaluated in the context of XML.
2) OO languages provide extensive facilities for inheritance of data members
(quite independently of methods), and these concepts would also be very
valuable in this context.
3) Additional thought must be given to adapting the content model of
existing element types in a base DTD without having to write out a whole new
content model. This is pretty scary, but I imagine it would be possible to
define primitives saying things like:
a) certain new element types can be inserted in front of the existing
content model.
b) certain new element types can be appended at the end of the existing
content model.
c) certain new element types can be inserted at a given location in the
existing content model.
d) etc.
I'd be really interested in reading others thoughts on this matter.
Cheers,
Matthew
-----Original Message-----
From: Tim Bray <tbray@textuality.com>
To: xml-dev@ic.ac.uk <xml-dev@ic.ac.uk>
Date: Friday, April 17, 1998 6:07 AM
Subject: Re: Problems parsing XML
>At 10:35 PM 14/04/98 -0500, len bullard wrote:
>>> [Chris Maden <crism@ora.com>:]
>>> > One fundamental flaw in _XML Complete_ is Holzner's apparent belief
>>> > that you must write Java code in order to do anything useful with
>>> > XML.
>
>>Markup doesn't care. That's the beauty of it. :-
>
>Yes! What he said. As a result of having been a programmer since
>A.D. 1979, my faith in interoperable APIs is torn and shredded.
>But I think that interoperable syntax is usefully achievable.
>Hence, XML. -T.