xsl-list
[Top] [All Lists]

Re: [xsl] [Musing] User Preference for Functional Programming

2013-07-10 12:55:07
On Wed, 2013-07-10 at 10:32 -0700, Hank Ratzesberger wrote:


I am only conversing here, I hope not to take your time if you are not
interested.

Do not worry: you pose an interesting and useful question.

[...]
  
awardType.getAwardID().getAwardContractID().setModNumber(fpdsInfo.getModNum());

vs:

  /award/awardID/awardContractID/modNumber=FpdsInfo:modNum


And a colleague spoke to me and said, 'Well, I much prefer action
words, they explain what is happening'

Well, your first example is much close to a modern programming idiom, so
it will have a high comfort factor. Your second, by the way, would be
greatly improved with spaces around the = sign.

There are two intermingled questions here:
. which syntax is preferred
. which semantics are preferred.

But the two approaches are also not mutually exclusive. For example,
what if you write,

xpath("/award/awardID/awardContractID").setModNumber(fpdsInfo.getModNum());

Now there's a declarative part embedded in a procedural part. You could
go one step further,

xpath("/award/awardID/awardContractID") .
               setModNumber( xpath("FpdsInfo:modNum") );

Both the .set/.get and the XPath syntx are domain-specific languages,
but people come to them with different expectations.

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--