XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] RE: Declarative programming requires a different mindset


> Question: When you create XSLT transforms or XQueries, how do you maintain a declarative mindset, and avoid slipping back into an imperative mindset?
>
> /Roger
>
>    

Unfortunately I haven't reached that stage yet.  I wish I have, but I'd 
be lying.

Instead when my Imperative mindset hits a brick wall and what I want to 
code simply is not expressible my brain starts to hurt,
until I come up with another approach that is expressible.   Learning a 
few "design patterns" has helped ..
Such as "When I would use iteration,  instead use recursion",  "When I 
want to modify something, instead Use a function to create an 
intermediate element/sequence and query/filter on that".

Thinking out loud,  I'd definitely buy a book (RARE for me ..) that maps 
imperative design patterns to declarative patterns.
I've been programming in XQuery for several years now and still find it 
frustrating to do what should be simple things.
For the most part I believe its not because they are not simple in 
XQuery but because I am 30 years trained in imperative/procedural 
thinking and old
dogs have a hard time with new tricks.

---- To change topics (yes I'm too lazy to write a new email ) ----
Your example with XQuery with Updates has me thinking.
What is the intended use case for XQuery with Updates.
My impression is that the intended use case is to modify an existing XML 
document 'in place'.
That by running insert/delete/update statements the end result is 
intended to update a document.
However your examples over the last week have all been query based ... 
or I think they are.
That is ... perform a (read only) query on a document using update 
semantics.
Is this an intended use case of XQuery with Updates ? If so I've been 
missing the boat !

-David


-- 
-------------------------
David A. Lee
dlee@calldei.com
http://www.calldei.com
http://www.xmlsh.org




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS