<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: WS-DuckTyping</title>
	<atom:link href="http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/</link>
	<description>A blog about programming in .NET and Java</description>
	<pubDate>Sat, 04 Jul 2009 21:03:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anders Norås' Blog</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1100</link>
		<dc:creator>Anders Norås' Blog</dc:creator>
		<pubDate>Mon, 02 Apr 2007 14:38:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1100</guid>
		<description>&lt;p&gt;&lt;strong&gt;WS-Duck for Windows Communication Foundation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Last week I blogged about Arjen's WS-Duck Typing and how Spring-WS enables "duck typed" web services.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>WS-Duck for Windows Communication Foundation</strong></p>

<p>Last week I blogged about Arjen&#8217;s WS-Duck Typing and how Spring-WS enables &#8220;duck typed&#8221; web services.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Solution Architecture</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1096</link>
		<dc:creator>Solution Architecture</dc:creator>
		<pubDate>Fri, 30 Mar 2007 21:44:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1096</guid>
		<description>&lt;p&gt;&lt;strong&gt;Entity Framework: Disconnected Problems &amp; Solutions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Andres Aguiar points out an enormous change to the behavior of data access in tiered architectures that...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>Entity Framework: Disconnected Problems &amp; Solutions</strong></p>

<p>Andres Aguiar points out an enormous change to the behavior of data access in tiered architectures that&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: James Watson (a.k.a Jimmy James)</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1095</link>
		<dc:creator>James Watson (a.k.a Jimmy James)</dc:creator>
		<pubDate>Thu, 29 Mar 2007 21:02:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1095</guid>
		<description>&lt;p&gt;I don't have any disagreement that XPath is easier.  I think it's far superior to custom SAX.  SAX is actually better suited for completely generic transformations (pretty printers etc.)  XQuery is also something to look into.  Xpath 2.0 is a very nice to work with.&lt;/p&gt;

&lt;p&gt;My opinion on validation comes from experience.  The B2B system that I worked on tried to take this many messages, one transformation process.  It ended up being a huge unmaintainable mess where pretty much every change resulted in problems processing stable clients' messages.  The approach that did work was having a canonical form and transforming everything into that form to pass on to a core processing module.  This is actually more flexible because you can still use the approaches you are advocating when it makes sense.  It also let us process messages using completely different and incompatible standards with the same core functionality.&lt;/p&gt;

&lt;p&gt;This approach takes more work than what you are advocating but for industrial strength b2b services it's a best practice.  Really, it supercedes that approach.  It may be overkill for some situations but we had 100s of consumers and producers to support.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I don&#8217;t have any disagreement that XPath is easier.  I think it&#8217;s far superior to custom SAX.  SAX is actually better suited for completely generic transformations (pretty printers etc.)  XQuery is also something to look into.  Xpath 2.0 is a very nice to work with.</p>

<p>My opinion on validation comes from experience.  The B2B system that I worked on tried to take this many messages, one transformation process.  It ended up being a huge unmaintainable mess where pretty much every change resulted in problems processing stable clients&#8217; messages.  The approach that did work was having a canonical form and transforming everything into that form to pass on to a core processing module.  This is actually more flexible because you can still use the approaches you are advocating when it makes sense.  It also let us process messages using completely different and incompatible standards with the same core functionality.</p>

<p>This approach takes more work than what you are advocating but for industrial strength b2b services it&#8217;s a best practice.  Really, it supercedes that approach.  It may be overkill for some situations but we had 100s of consumers and producers to support.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Tilkov</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1094</link>
		<dc:creator>Stefan Tilkov</dc:creator>
		<pubDate>Thu, 29 Mar 2007 19:50:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1094</guid>
		<description>&lt;p&gt;@Jimmy: Your points are valid, and you are right about SAX not being mentioned in ERH's article. In my experience, XPath is a lot easier to get right, and code based on XPath is a lot more stable in face of changes, than equivalent code that uses XML APIs - especially DOM, but also (to a lesser degree) SAX and StAX, although with the latter two, the reason is most likely a lack of experience on the programmer's side.&lt;/p&gt;

&lt;p&gt;I can understand your POV on validation, but I don't agree with it. Which I think is OK, and does not imply that either you or Arjen practised "FUD" -- just that we have different experiences.&lt;/p&gt;

&lt;p&gt;Glad to see the discussion focusing on technical aspects now.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Jimmy: Your points are valid, and you are right about SAX not being mentioned in ERH&#8217;s article. In my experience, XPath is a lot easier to get right, and code based on XPath is a lot more stable in face of changes, than equivalent code that uses XML APIs - especially DOM, but also (to a lesser degree) SAX and StAX, although with the latter two, the reason is most likely a lack of experience on the programmer&#8217;s side.</p>

<p>I can understand your POV on validation, but I don&#8217;t agree with it. Which I think is OK, and does not imply that either you or Arjen practised &#8220;FUD&#8221; &#8212; just that we have different experiences.</p>

<p>Glad to see the discussion focusing on technical aspects now.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy James</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1092</link>
		<dc:creator>Jimmy James</dc:creator>
		<pubDate>Thu, 29 Mar 2007 18:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1092</guid>
		<description>&lt;p&gt;On a side note, RELAX NG appears to offer a lot of improvement over the W3C schema (I haven't had a chance to use it for real work.)  But I know it allows validating an element's contents without respect to order.  w3c doesn't provide an easy way to do things like this.  This kind of improvement might alleviate some of the problems people are seeing with strict validation.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>On a side note, RELAX NG appears to offer a lot of improvement over the W3C schema (I haven&#8217;t had a chance to use it for real work.)  But I know it allows validating an element&#8217;s contents without respect to order.  w3c doesn&#8217;t provide an easy way to do things like this.  This kind of improvement might alleviate some of the problems people are seeing with strict validation.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: sean</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1091</link>
		<dc:creator>sean</dc:creator>
		<pubDate>Thu, 29 Mar 2007 17:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1091</guid>
		<description>&lt;p&gt;I can see valid points to both validating and non validating xml schema with respect to messages, but I'd have to agree more with the validating side when it comes to real-world business driven scenarios. the notion, "If I cant find 'phone number' where I thought it would be, but it does exist somewhere else in a message, so just use that one and be 'graceful'" simply seems unrealistic and irresponsible when you're doing anything more than "hello world, here's my phone number".
I think the thought process behind this blog post about "duck"-typing can lead to more tolerant technologies in the future, but as it stands currently, offers little real world value where contracts are more a tool to describe where one party's concern ends and another begins.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I can see valid points to both validating and non validating xml schema with respect to messages, but I&#8217;d have to agree more with the validating side when it comes to real-world business driven scenarios. the notion, &#8220;If I cant find &#8216;phone number&#8217; where I thought it would be, but it does exist somewhere else in a message, so just use that one and be &#8216;graceful&#8217;&#8221; simply seems unrealistic and irresponsible when you&#8217;re doing anything more than &#8220;hello world, here&#8217;s my phone number&#8221;.
I think the thought process behind this blog post about &#8220;duck&#8221;-typing can lead to more tolerant technologies in the future, but as it stands currently, offers little real world value where contracts are more a tool to describe where one party&#8217;s concern ends and another begins.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy James</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1090</link>
		<dc:creator>Jimmy James</dc:creator>
		<pubDate>Thu, 29 Mar 2007 13:59:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1090</guid>
		<description>&lt;p&gt;Arjen-&lt;/p&gt;

&lt;p&gt;You write:&lt;/p&gt;

&lt;p&gt;"So instead, in might be useful to create one course-grained type, and use that in all operations, which eventually results in sending more information than is strictly required. The question is whether you want to validate this non-required information."&lt;/p&gt;

&lt;p&gt;This may seem like a good idea but when you have hundreds of different producers all with their own idiosyncrasies, it's going to turn into spaghetti code.  How is this any different than the monolithic procedural approaches of the past?  I prefer an object-oriented-like approach where each message has it's own type.&lt;/p&gt;

&lt;p&gt;I think calling this approach duck-typing is a little misleading.  In duck-typing, a given object is treating as being a certain type if it has the required operations.  That's part of the technique you are describing.  But the other part is not similar to duck-typing.  It's more like pattern matching but I predict that in most cases it will degenerate into something more like the following (sometimes necessary) anti-pattern:&lt;/p&gt;

&lt;p&gt;if type(input) == str:
   // do this
elif type (input) == dict:
   // do that
else:
   // do the default&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Arjen-</p>

<p>You write:</p>

<p>&#8220;So instead, in might be useful to create one course-grained type, and use that in all operations, which eventually results in sending more information than is strictly required. The question is whether you want to validate this non-required information.&#8221;</p>

<p>This may seem like a good idea but when you have hundreds of different producers all with their own idiosyncrasies, it&#8217;s going to turn into spaghetti code.  How is this any different than the monolithic procedural approaches of the past?  I prefer an object-oriented-like approach where each message has it&#8217;s own type.</p>

<p>I think calling this approach duck-typing is a little misleading.  In duck-typing, a given object is treating as being a certain type if it has the required operations.  That&#8217;s part of the technique you are describing.  But the other part is not similar to duck-typing.  It&#8217;s more like pattern matching but I predict that in most cases it will degenerate into something more like the following (sometimes necessary) anti-pattern:</p>

<p>if type(input) == str:
   // do this
elif type (input) == dict:
   // do that
else:
   // do the default</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy James</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1089</link>
		<dc:creator>Jimmy James</dc:creator>
		<pubDate>Thu, 29 Mar 2007 13:47:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1089</guid>
		<description>&lt;p&gt;Arjen-&lt;/p&gt;

&lt;p&gt;That's reasonable.  I suppose a lot of this depends on the context.  In my B2B experience, messages were effectively contracts often worth hundreds of thousands of dollars a pop.  It's not sensible to be loose and fast with this kind of thing.  Accepting a bad message would even violate our service agreements.  But now I am using XPath to glean info from exported 'code' from a gui and I couldn't care less about the schema.  I'm /*//ing without a care in the world.&lt;/p&gt;

&lt;p&gt;But to imply validation is an ineffective technique is not correct.  It may not be appropriate in all contexts but it's definitely very useful and important in many others.  The problems with different messages still arise but the solution is different when you need strict validation.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Arjen-</p>

<p>That&#8217;s reasonable.  I suppose a lot of this depends on the context.  In my B2B experience, messages were effectively contracts often worth hundreds of thousands of dollars a pop.  It&#8217;s not sensible to be loose and fast with this kind of thing.  Accepting a bad message would even violate our service agreements.  But now I am using XPath to glean info from exported &#8216;code&#8217; from a gui and I couldn&#8217;t care less about the schema.  I&#8217;m /*//ing without a care in the world.</p>

<p>But to imply validation is an ineffective technique is not correct.  It may not be appropriate in all contexts but it&#8217;s definitely very useful and important in many others.  The problems with different messages still arise but the solution is different when you need strict validation.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Arjen Poutsma</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1088</link>
		<dc:creator>Arjen Poutsma</dc:creator>
		<pubDate>Wed, 28 Mar 2007 23:33:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1088</guid>
		<description>&lt;p&gt;@Jimmy&lt;/p&gt;

&lt;p&gt;In my post, I said that code written with SAX is "typically quite fragile". This doesn't mean that all SAX code is fragile. It just means that, as you stated yourself, a lot of people don't get functional APIs, and tend to write fragile SAX code. This isn't about what I do, nor is it about you do, nor is it what I recommend, but it's about what I've seen happen in the field. The same thing applies to StAX or DOM code, by the way: the  code in the link that Stefan posted can be made less fragile by not assuming the first element is the only interesting element. It &lt;em&gt;can&lt;/em&gt; be done in a better way, but it's not typical. XPath just conveniently bypasses these issues.&lt;/p&gt;

&lt;p&gt;Also, grabbing an element from somewhere else can be perfectly acceptable in some cases. If a small document only contains one phone number, then who cares where it is located? If it contains multiple phone numbers (like in the address example you describe), then grabbing it from anywhere is probably a bad idea. It all depends on the context.&lt;/p&gt;

&lt;p&gt;@Contract Nazi
I don't agree. The question is not whether the message conforms to the schema; but whether it contains the information required to process the request. These two might be the same (i.e. the schema only contains the necessary information), but that might mean that you will end up with a lot of similar types in the schema (i.e. one type per operation). So instead, in might be useful to create one course-grained type, and use that in all operations, which eventually results in sending more information than is strictly required. The question is whether you want to validate this non-required information.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Jimmy</p>

<p>In my post, I said that code written with SAX is &#8220;typically quite fragile&#8221;. This doesn&#8217;t mean that all SAX code is fragile. It just means that, as you stated yourself, a lot of people don&#8217;t get functional APIs, and tend to write fragile SAX code. This isn&#8217;t about what I do, nor is it about you do, nor is it what I recommend, but it&#8217;s about what I&#8217;ve seen happen in the field. The same thing applies to StAX or DOM code, by the way: the  code in the link that Stefan posted can be made less fragile by not assuming the first element is the only interesting element. It <em>can</em> be done in a better way, but it&#8217;s not typical. XPath just conveniently bypasses these issues.</p>

<p>Also, grabbing an element from somewhere else can be perfectly acceptable in some cases. If a small document only contains one phone number, then who cares where it is located? If it contains multiple phone numbers (like in the address example you describe), then grabbing it from anywhere is probably a bad idea. It all depends on the context.</p>

<p>@Contract Nazi
I don&#8217;t agree. The question is not whether the message conforms to the schema; but whether it contains the information required to process the request. These two might be the same (i.e. the schema only contains the necessary information), but that might mean that you will end up with a lot of similar types in the schema (i.e. one type per operation). So instead, in might be useful to create one course-grained type, and use that in all operations, which eventually results in sending more information than is strictly required. The question is whether you want to validate this non-required information.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Contract Nazi</title>
		<link>http://blog.springsource.com/arjen/archives/2007/03/27/ws-duck-typing/comment-page-1/#comment-1087</link>
		<dc:creator>Contract Nazi</dc:creator>
		<pubDate>Wed, 28 Mar 2007 22:36:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.springframework.com/arjen/archives/2007/03/27/ws-duck-typing/#comment-1087</guid>
		<description>&lt;p&gt;If it's services you are talking about, then it's all about the service contract which, in an abstract sense says:&lt;/p&gt;

&lt;p&gt;"If you send me a message constructed within these constraints I'll guarantee to respond in this predicatble way."&lt;/p&gt;

&lt;p&gt;The inference being, that if the service consumer does not abide by the published constraints, that is the contract, then all bets are off. The service provider doesn't need to validate the request in order to meet his side of the contract.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If it&#8217;s services you are talking about, then it&#8217;s all about the service contract which, in an abstract sense says:</p>

<p>&#8220;If you send me a message constructed within these constraints I&#8217;ll guarantee to respond in this predicatble way.&#8221;</p>

<p>The inference being, that if the service consumer does not abide by the published constraints, that is the contract, then all bets are off. The service provider doesn&#8217;t need to validate the request in order to meet his side of the contract.</p>]]></content:encoded>
	</item>
</channel>
</rss>
