[xquery-talk] XQuery and Web 2.0

Jason Hunter jhunter at servlets.com
Fri Apr 25 15:00:15 PDT 2008

Michael Kay wrote:
>> 2) What is it about XQuery that would stop you being able to 
>> write your entire application in XQuery?
> The #1 reason I have found it hard to write significant applications in
> XQuery is the lack of polymorphism.
> If you want to write a simple query to do a single well-defined job, XQuery
> works very well. If you want to write an application capable of doing
> different tasks under different circumstances, with reuse of internal
> components, and variety in the input documents (or output documents), then
> the absence of any kind of polymorphism really starts to hurt.
> XSLT has two facilities - template rules and import precedence - that give
> it a major advantage once you are doing anything more substantial than a
> one-off task using a couple of hundred lines of code.
> I'd be interested to hear from people who have developed substantial
> applications in XQuery (like markmail) how they got around this problem.


I've been thinking about your question a little bit.  I think the 
simplest answer is that we code with patterns like you use when writing 
C code.  A very high-level, declarative kind of C code.  :)

The core MarkMail web app runs on ~5,000 lines of pure XQuery code.  A 
bit over 80% of that is in reusable libraries.

When writing the app we think in XML.  The back-end is an XML store, the 
front end is an XHTML browser, and the language bringing the two 
together is XML-native.  It's very convenient.  I spoke on this topic at 
XML 2007, as some on the CC list may recall.



More information about the talk mailing list