Lists Home |
Date Index |
- From: Ken MacLeod <firstname.lastname@example.org>
- To: "XML List" <email@example.com>
- Date: 26 Feb 1999 11:10:42 -0600
>>>>> "David" == David Megginson <firstname.lastname@example.org> writes:
> Bill la Forge writes:
>> >Event-based programming existed before people started
>> >encapsulating events in structures or objects. I'd define SAX
>> as >an event-based API that reports events using callbacks.
>> But why are we not taking advantage of having the events as
>> objects? I've tried to second guess why this is so, but I
>> think the arguments in favor of object-based events is
>> stronger: the added overhead is balanced by greater simplicity
>> and subsequently less overhead in other areas; the added
>> flexability adding additional utility to all conformant code.
David> From a design-pattern perspective, Bill is absolutely right:
David> encapsulation and abstraction are big winners, and the way
David> that he suggests is the proven method for building a robust
David goes on to say that using event objects will increase the size
of the implementation, increase the learning curve, and increase the
burden of documentation. These statements seemed to be based on the
_unstated_ assumption that unique event classes will be used for every
type of event.
Why is it necessary to use unique event classes for each type of
event? Why not use a NamedNodeList or simple dictionary type that can
hold the properties of the event?
If a simple dictionary type is used, then the implementation will
increase only by the size of one class (assuming a built-in class
isn't used), the documentation can be written in terms of the XML
Information Set (which XML application developers will need to be
familiar with anyway), and would still provide all the advantages Bill
la Forge is describing.
I used this design pattern in writing the Perl binding to SAX and,
although it hasn't been time-tested yet, the initial implementations
show a lot of promise and flexibility.
The draft for Perl SAX is available at:
xml-dev: A list for W3C XML Developers. To post, mailto:email@example.com
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:firstname.lastname@example.org the following message;
To subscribe to the digests, mailto:email@example.com the following message;
List coordinator, Henry Rzepa (mailto:firstname.lastname@example.org)