On Fri, Oct 08, 2004 at 06:26:51PM +0200, Lars Gullik Bjønnes wrote:
> John Weiss <[EMAIL PROTECTED]> writes:
> 
> | The DTD for an XML format (or, if you prefer, the XSchema for an XML
> | format) is like the header file for a C++ class.  A file with "an XML
> | look" is the *implementation* of an instance of a C++ class.
> 
> I don't really agree with this analogy.

Nevertheless, it's what I've had direct experience with in the field,
on projects in the workplace.

> | "Playing around with the XML look" is far, far, FAR easier to do from
> | within a DTD.
> 
> Is it really?

Oh G*d yes!  Projects that try to reverse-define the DTD later fail
spectacularly.  There's always something absolutely critical that the
parser implementation missed, requiring heavy rewriting.

Now, there's also the other extreme:  pure, abstract, ivory-tower
definitions of a DTD whose requirements make the parser & code
implementation unworkable.  I am *not* advocating that!  :)

We want the happy-medium:  a DTD suggested by a pre-existing parser
implementation, but designed for the future.  ;)


I come back to something I said in a different post:  Creating XML
formats requires a different way of thinking than designing OO-code.

Here's a question for everyone reading:  Ever worked with SQL?  When I
first learned SQL, I had my brain stuck in C++-programmer-mode.
Remember how you had to keep reminding yourself, "Use JOIN's; there
are no for-loops.  Use JOIN's; there are no for-loops...."  Me too.

Well, XML formats are yet another paradigm-shift.  They require
different thinking than other sorts-o-coding.


Lastly, moving to an XML-format for LyX gives us an excuse to make
some potentially long-overdue changes to the LyX core data
structures.  Lars, I *know* all of those enums that fire off different
functions via switch-statements *must* make your skin crawl everytime
you see them.  I'm sure you have whole blocks-o-code you'd like to
refactor into abstract classes.  Thinking about the format ... since
it's such a big change, anyhow ... gives us permission to make those
changes/cleanups.

But, it doesn't require them.  :)

-- 
John Weiss

Reply via email to