Parameters best practice - ordered parameters vs structs?

"Dave" <[email protected]>
Newsgroups gmane.text.xml.rpc.specification
Message-ID <[email protected]>
Hi everyone, I've written a few XML-RPC APIs and I've always used
structs to pass named parameters, plus in the APIs I've used, this has
also been the case, so method calls look like:

<methodCall>
  <methodName>updateUser</methodName>
  <params>
  <param>
    <value><struct>
	  <member>
	    <name>username</name>
        <value>bob<value>
      </member>
	  <member>
	    <name>address</name>
        <value>bob's place<value>
      </member>
	  <member>
	    <name>code</name>
        <value><i4>1234</i4><value>
      </member>
    </struct></value>			
  </param>
  </params>
</methodCall>

rather than

<methodCall>
  <methodName>updateUser</methodName>
  <params>
  <param>
    <value>bob<value>			
  </param>
  <param>
    <value>bob's place<value>			
  </param>
  <param>
    <value>bob's place<value>			
  </param>
  <param>
    <value><i4>1234</i4><value>			
  </param>
  </params>
</methodCall>

Until recently I thought nothing of it.  Then, a couple of days ago
someone questioned why I used structs and I suggested that I thought
it was:

a) Self-documenting in logs
b) Easier to read in exaples in a spec document
c) Likely to cause less implementation errors as each value is paired
with its name
d) Easier to provide errors back to the client (username invalid is
easier to understand if you passed a parameter called username)
e) It's much easier to add an argument in future versions of the spec
while maintaining backward compatability with older versions.

But the arguments against were perfectly valid:

a) The XML docuemnt becomes large and can look messy in documents
b) The spec is designed for ordered parameters
c) Using named parameters increases the complexity of server-side
argument checking (i.e. it's no longer a case of providing a method
with matching arguments)
d) Since the XML should never be seen (both sides will use an XML RPC
library) all that matters is that the method signatures are written
correctly the first time.


So, I was wondering if there were any thoughts on which method was
best or whether there is an argument for each method in different
situations?

http://effbot.org/zone/xmlrpc-errata.htm gives a tantalising hint that
there may be some standard practice "To be added (?): ... extensible
interfaces (simulating keyword arguments).", but beyond this all my
searches on this mailing list with google and in all my XML RPC books
have failed to come up with an answer, so does anyone have any thoughts?

Thanks

Dave








 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/xml-rpc/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.