I think Guido's post on XML is a good occasion to point again to my rant about the disdain for XML among Python programmers, posted almost exactly a year ago on this blog. I don't think Guido is right on the no XML in my template issue. I don't think he's wrong either. There are about as many ideas about what a templating language should be like as there are Python programmers, and Guido is, obviously, being a python programmer in this. Guido's rejection of XML for his own templating needs should not lead python programmers into believing that they can look at XML technologies in general with disdain. Yes, XML is often misapplied. It has problems. That doesn't mean XML technologies are always useless, that they should never be considered in any software project, or that XML technologies can be safely ignored.
(10) Wed Feb 01 2006 12:07 Guido and XML:
- Comments:
Posted by Peter Bengtsson at Wed Feb 01 2006 13:57
I agree with you. Or actually, I don't understand why he doesn't share my need to valid xmlish markup, eg. xhtml. Without validating markup Javascript DOM manipulations become not only harder but damn unpredictable. And DOM manipulations is the cornerstone of AJAX which is proving to be a winner.
Posted by Duncan McGreggor at Wed Feb 01 2006 15:34
I agree with the basic premise that XML is a binary format. From a user's perspective, it really should be considered machine-readable and not human readable.But I don't believe it is of any use to cast *all* XML in that light -- context needs to be considered. Take HTML/XHTML for instance. I know many graphic designers and HTML coders who don't use Dreamweaver or the like, but prefer to manipulate the files directly. They are conversant and skilled, and this gives them more flexibility to tweak in just the ways they need.That being said, even if you ARE going to paint all XML as never-human-readable, how does that possibly exclude its use as a templating approach? I want my *designers* touching my templates. I want HTML gurus to deal with it. Not me! They open up the templates in their preferred HTML editor (i.e., machine readable), and hack away.Maybe Guido just lives in a world where there are no designers...
Posted by Martijn Faassen at Wed Feb 01 2006 16:19
Just to make it clear; I don't think XML is a binary format. It's a compromise solution - something that's at least semi-human readable and writable, but can be used instead of proprietary binary solutions. I think the benefits of this somewhat human workable nature of XML have been demonstrated - we have more open document formats, more open protocols, less new syntaxes that I have to learn when dealing with yet another configuration language, and so on. I think this is better than a world where everything would be using binary or custom syntaxes.I also like XML as a document format, but on the other hand I don't think end-users need to see raw XML. The entities likely encountering XML will be software, system administrators, programmers, and template designers, not end-users.I myself like my templates being XHTML; it has significant benefits for working with designers, and encourages a general separation of concerns (designers are not programmers and preferably shouldn't see a lot of programming code). But I'm not going to debate it with Guido - every Python developer has its own opinions about templates, and that's why there are about as many templating systems as Python programmers. :)
Posted by Someone at Wed Feb 01 2006 18:42
I suspect folks like Guido, whom are very smart and very focused, simply can't imagine a world where collaboration partners need to use tools that he might eschew (like WYSIWYG design tools). It's likely inconceivable to him that someone might walk on to the project that can't quickly understand basic programming constructs and just ins't interested on what goes on "under the hood" even though they might otherwise be incredibly helpful on the design side. This is a weakness of optimistic smart people. Time solves it.
Posted by Martijn Faassen at Wed Feb 01 2006 20:39
Hey Someone - that's true, it's generally hard for programmers, including myself, to accept that. In addition, enabling such people in a way that is not too disruptive to good software engineering practices is a hard problem in itself (see earlier blog entries on this blog).
Posted by anonymous@146.169.6.50 at Thu Feb 02 2006 16:27
I think Guido's point is that not everything that needs to be expanded from a template is XML or even markup at all. There's a lot more to python and programming in general than writing web apps. An XML-only templating system won't help generate Python source code, CSV files, dot diagrams, etc. etc. etc.Blinkers off, chaps!
Posted by Martijn Faassen at Thu Feb 02 2006 19:08
I don't actually want to be drawn into a debate on templating languages. Pick what you like. I still will share some of my thinking about the subtleties and tradeoffs involved in templating systems.An obvious advantage of a non-XML generic text templating system is that it can be used for other things than just HTML and other XML-y results. Potential disadvantages of such an approach:* a generic system may be less than optimally suitable for templating any particular format, such as dot file, XML, CSV files, etc. A more dedicated generation system could be easier to use for particular purposes. For generating CSV files I'd recommend a Python module in the core library, for instance.* in the particular case of HTML and XML in general, there is a lot of tool support for these technologies, from editors to validators. A templating language that's friendly to such tools would be nice.* additionally, in the case of HTML in particular, it often becomes important that templates don't look too intimidating to non-programmers. A templating language that is limited in its expressivity is actually useful there. If your target audience is only programmers the tendency would exist to make the templating language maximally expressive.The topic of expressivity of templating languages is an interesting one for other reasons. Less expressivity may not only help programmers and designers work together better, but also ties in to encouraging model/view separation, to potentially increasing debuggability, and to potential performance optimizations. A model of only pushing data into templates as opposed to pulling it by calling (Python) code (which may take time, may have errors that appear while working on the template, etc), like the one ClearSilver or XSLT employ, is interesting in those aspects as well.Anyway, this is turning quickly into another blog posting, so to conclude, I would argue I don't have my blinkers on in this, but have actually thought about this topic quite carefully. Whether my ideas and conclusions are going in the right direction is something that I'd like to explore further.
Posted by Chris McDonough at Fri Feb 03 2006 08:00
Guido also mentioned his distaste for XML in the context of his desire to generate HTML for a web app, not any other use, so I'd say our blinkers are quite off.
Posted by Paul Everitt at Sat Feb 04 2006 10:16
Here's a part I can't square the argument. On one hand, Python ("pythonic") tries to promote things like "explicit is better than implicit". This applies not just to language idioms, but to things like indentation. When the curly bracket people squeal, Python people reply: "We took good practice and made it mandatory."Python people also promote unit testing over static typing. If your code can't be tested, or it breaks my tests, it isn't good code.Explicit vs. implicit, enforced syntax cleanliness, easy to test.But then, Guido wants the freedom of HTML, where you can put any ol' vomit in there and the parsers will be forgiving. The three points just mentioned: do they sound more like XHTML or HTML?
Posted by Shaun at Tue Feb 07 2006 11:30
In the context of a generic templating language, I think he's got a point. Witness having to drop back into DTML for a ZSQL Method or whatever ;-)In the context of *ML based markup, I'm very much on the XML side of the fence.I wonder how it's possible to reconcile these?
