The Artima Developer Community
Sponsored Link

Weblogs Forum
Which Part of "No XML" Don't You Understand?

59 replies on 4 pages. Most recent reply: Mar 7, 2006 6:39 PM by Robin Parmar

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 59 replies on 4 pages [ 1 2 3 4 | » ]
Guido van van Rossum

Posts: 359
Nickname: guido
Registered: Apr, 2003

Which Part of "No XML" Don't You Understand? (View in Weblogs)
Posted: Jan 31, 2006 8:04 AM
Reply to this message Reply
Summary
The XML crowd don't seem to get it. I don't *want* to use XML in my templates. Now can they leave me alone and stop telling me that I want XML?
Advertisement

To the supporters of [1] Nevow, Kid and other XML-based templating engines.

I really don't think I can explain this any better. I don't want to use XML in my templates. I don't want to generate XML and I don't want to have to type XML to tell the template engine what to do. You keep telling me that I want XML, but that simply isn't the case, so stop wasting your time (and mine).

I'm not saying that there's no use for XML. But if you see XML as the solution to every problem, well, that's a problem.

([1] PyMeld removed from this list since it doesn't belong.)


Ravi Venkataraman

Posts: 80
Nickname: raviv
Registered: Sep, 2004

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 8:18 AM
Reply to this message Reply
Thank you for bringing some rationality to the XML hype.

Such a statement from one in your position should lead a lot of people to stop and think about XML and use it only where appropriate.

Maybe, just maybe, we can even think of reducing the number of XML configuration files deemed necessary to implement so much of the mainstream application server products and frameworks.

Ravi

Richie Hindle

Posts: 3
Nickname: richieh
Registered: Jan, 2006

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 8:25 AM
Reply to this message Reply
PyMeld doesn't want you to use XML in your templates. It doesn't want you to generate XML and it doesn't want you to have to type XML to tell it what to do. I would never tell you that you want XML, because that would waste your time (and mine).

PyMeld will work with XML if you want it to. It will also work with real-world HTML, and was designed from the outset to do so. The only restriction it places on the HTML is that attribute values must be quoted (ie. <img alt="Good"> rather than <img alt=Bad>). Other than that, it will work with whatever HTML you care to throw at it.

Part of the reason I wrote PyMeld was that I didn't want to have to write XML.

Michael Foord

Posts: 13
Nickname: fuzzyman
Registered: Jan, 2006

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 9:16 AM
Reply to this message Reply
Hey, I agree. ;-)

Ironically (or possibly not) in the discussion about extending ConfigParser you recommended XML as the solution for complex application configuration.

There are a lot of people who don't want to use it for that either...

Michael Foord

Chris McDonough

Posts: 4
Nickname: mcdonc
Registered: Jan, 2006

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 9:30 AM
Reply to this message Reply
Hi Guido,

Regardless of what the input format is, do you want always to output XML/HTML or are you going to be templating CSS and the like as well with the same tool?

Guido van van Rossum

Posts: 359
Nickname: guido
Registered: Apr, 2003

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 9:35 AM
Reply to this message Reply
> Ironically (or possibly not) in the discussion about
> extending ConfigParser you recommended XML as the solution
> for complex application configuration.

You are misrepresenting what I said. I specifically *opposed* XML for *configuration* (which implies that users edit it to express their preferences) but *recommended* it for *internal* persistent data storage (which is never edited by end users even though sometimes developers may like to mess with it).

To me this represents the crux of the XML choice. Humans writing (or even reading) XML is bad. Programs reading and writing it is good. Developers editing the XML that their program wrote is of course fine -- but only as a development / testing / debugging technique.

Guido van van Rossum

Posts: 359
Nickname: guido
Registered: Apr, 2003

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 9:42 AM
Reply to this message Reply
> PyMeld doesn't want you to use XML in your templates. It
> doesn't want you to generate XML and it doesn't want you
> to have to type XML to tell it what to do.
[...]
> Part of the reason I wrote PyMeld was that I didn't want
> to have to write XML.

Fair enough. It falls in the category of DOM manipulation APIs (where DOM should be taken in the widest possible sense of the word :-). That's a fine type of tool, and there are a whole slew of them (e.g. Chris Withers is working on one named Twiddler).

I happen to dislike this part of the first PyMeld example:

>>> print page.message
<textarea ...>Foo</textarea>
>>> page.message = "Bar"
>>> print page.message
<textarea ...>Bar</textarea>

I would have expected the secont print to print "Bar". I understand that the actual behavior is more useful, but API-wise it's confusing -- the assignment doesn't do an actual assignment to the target template but somehow modifies one of its attributes.

Anyway, I don't want a DOM manipulation tool either, because it will end up creating a pretty tight coupling between the HTML and the Python code manipulating it -- probably tighter than for Cheetah/Django/etc. style templates.

Richie Hindle

Posts: 3
Nickname: richieh
Registered: Jan, 2006

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 9:55 AM
Reply to this message Reply
[Guido]
> Anyway, I don't want a DOM manipulation tool either, because it will end up creating
> a pretty tight coupling between the HTML and the Python code manipulating it

Fair enough, a DOM-based tool can certainly do that.

(May I request that you edit your blog post to remove PyMeld from the list of "XML-based templating engines"? It is most emphatically not such a thing, and I wouldn't want your many readers to think it was. Otherwise I'll start calling Python a "statically-typed bondage and discipline language" 8-)

Jordan Zimmerman

Posts: 23
Nickname: jordanz
Registered: Jul, 2003

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 10:10 AM
Reply to this message Reply
Hear hear!

It's considered modern to not have to write code any more. "Announcing new Framework X! Never write code, just write unintelligible XML descriptor files."

XML sucks: http://kensall.com/big-picture/

Morel Xavier

Posts: 73
Nickname: masklinn
Registered: Sep, 2005

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 10:17 AM
Reply to this message Reply
> XML sucks: http://kensall.com/big-picture/
But putting Javascript/ECMAScript in a graph about "The XML Family of Specifications" is stupid, as is putting JPEG, GIF or PNG there (what the hell do they have with XML, they're binary image formats), as is munching CSS with XML. And putting HTML 4.01 together with the rest is a bit of a stretch too.

Now I do understand that JS/ECMAScript or PNG can be used together with XML, but so can Python and I don't see Python on this graph.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 11:03 AM
Reply to this message Reply
> > XML sucks: http://kensall.com/big-picture/
> But putting Javascript/ECMAScript in a graph about "The
> XML Family of Specifications" is stupid, as is putting
> JPEG, GIF or PNG there (what the hell do they have with
> XML, they're binary image formats), as is munching CSS
> with XML. And putting HTML 4.01 together with the rest is
> a bit of a stretch too.
>
> Now I do understand that JS/ECMAScript or PNG can be used
> together with XML, but so can Python and I don't see
> Python on this graph.

I also don't see the new Office file formats.

Without commenting on whether XML does indeed suck, I find it odd to say XML sucks because it's been used to accomplish so many things. That is, a lot of the things in that picture are standards built on or using XML. It;s kind of like showing a picture of all the machines that use electicity and concluding that electricity sucks.

Now to the point of whethe XML sucks. It's not perfect, no, but a lot of standards aren't perfect. For example, Isambard Kingdom Brunel built a railroad that had a superior wide guage as compared to the guage that Robert Stephenson used. It was a huge mistake because Stephenson's guage had become the standard as it was used in so many more miles of track. Choosing a standard isn't always about choosing the best solution. It's about picking the most pragmatic solution.

Chris McDonough

Posts: 4
Nickname: mcdonc
Registered: Jan, 2006

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 11:16 AM
Reply to this message Reply
I don't think it's presently useful to have a discussion about whether XML is right to use for configuration files.

But it is appropriate to question whether it's appropriate to use as an input format for generating whatever Guido wants to generate from his templates. If Guido wants to generate XML (or HTML for that matter), then it's probably OK to use as an input format. If Guido doesn't want to use it, that's just a personal choice based on some experience he has had in the past. But if he wants to generate arbitrary textual output on a regular basis, then it would obviously be absurd to use XML as the input format. Even PHP would be better.

Laurent Szyster

Posts: 4
Nickname: lavs
Registered: Aug, 2005

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 11:30 AM
Reply to this message Reply
XML is not a panacea and an HTTP handler should also be able to produce something else than XML (like JSON, HTML, SVG, etc), we can all agree on that.

But Python web developers cannot and probably will not agree on a standard server-side template language. Because each tend to either specialize to a specific problem domain. And those that do not tend to be perform slowly.

Although I understand that bundling presentation and function into a single template "page" has very practical benefits, turning Python into some form of slow PHP is not precisely my idea of a productive and performant Python web development framework.

For ambitious web application developers, there are greater rewards if you separate logic from presentation. Then you may dump XML (or JSON, HTML, etc ...) directly:

print '<rest/>'

and use XSLT, JavaScript or whatever standard response transformation interface is available on the application's client.

This is as fast as serialization of a web response will get on the server, it saves bandwith and helps to distribute a significant part of the application on the clients.

Actually, given the availability of XSLT and the capabilities of JavaScript in modern browsers, I wonder which part of "No Templates" Python web developpers don't understand.


Kind Regards,

Anthony Tarlano

Posts: 9
Nickname: tarlano
Registered: Jun, 2003

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 11:48 AM
Reply to this message Reply
You should use QPY it's a standalone version of PTL from the Quixote framework.

Here is the link http://www.mems-exchange.org/software/qpy/

Anthony

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Which Part of "No XML" Don't You Understand? Posted: Jan 31, 2006 11:59 AM
Reply to this message Reply
> If Guido doesn't want to
> use it, that's just a personal choice based on some
> experience he has had in the past.

Surely. XML isn't good for writing by hand. I thought generally people use it because there are so many free parsers available. I think a lot of people fail to realize that arbitrary xml is rarely useful. In other words, you still need to use a proprietary syntax, it's just a subset of XML.

Flat View: This topic has 59 replies on 4 pages [ 1  2  3  4 | » ]
Topic: Web Framework Redux Previous Topic   Next Topic Topic: Java Posse Interview part 2

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use