[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: 3 Sins of XML Usage
On Thu, 2012-10-25 at 16:46 +0000, Costello, Roger L. wrote: > Hi Folks, > > Sin #1: Using Java to Process XML "Sin" is a strong word for many people. But maybe programming with the Java DOM is a living hell, so you have a point. The real message is "use a domain-specific language such as XPath, XSLT, XQuery, and don't process XML directly." > Sin #2: Designing XML in an Object-Oriented (OO) Fashion If we take the fundamental characteristics of OOP to be data hiding, implicit dispatch and message passing (e.g. from SmallTalk 80), then no, because these are orthogonal issues to XML design. If you mean, XML as objects then yes - XML elements are not generally objects in the OO sense. They don't have methods or classes. However, class-based inheritance (the usual OO mechanism for implicit dispatch, so you can say theShape->draw() and the drawing function appropriate to that particular shape gets used) overlaps with ontological inheritance (is-a), and ontological inheritance, the is-a hierarchy, is often very appropriate for XML. > Sin #3: Neglecting the Format of the Data How far down you go is always subjective and is subject in particular to cost/benefit speculation (I shall not ennoble that field with the term "analysis" since it's generally a form of Information Astrology). Your PDF document mentions IETF specs, and in a network protocol you may well end up labelling mantissa and exponent of a floating point number separately. On the other hand <timestamp date="Thu, 25 Oct 2012 14:11:20 -0400">... is perfectly fine in other IETF specs. (it's unfortunate that XML Schema doesn't recognise RFC2822 format as a date, I note in passing...) You neglect to mention the biggest "XML Sin" of all, which is true of almost everything we humans tend to do... it's making up rules, telling people what to do or what not to do in all situations. There are times (albeit not very many) when using DOM in Java is actually just fine, and there are times when a simple schema is appropriate, and there are times when OO design is very helpful. But there are not, I think, times when considering the context of a design first and best/worst practice guides second is a bad idea. :-) Regards, Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml Co-author, 5th edition of "Beginning XML", Wrox, Summer 2012
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|