TheChaseMan's Frenetic SoapBox

Always looking for better ways to do things...

Yet another post on the contract-first aproach

I have been spending a lot of time working on Web Services for my client, and I'm devoted to the contract-first design philosophy. However, being the pragmatic developer that I am...I'm using a hybrid approach for my architecture. Specifically, WebMethods are treated as either message-in, message-out, or both. So, the steps that I use are fairly straight forward: create an XSD, run XSD.exe /c to create a Data Transfer Object that adheres to the XSD contract, and keep my internal object model...well...internal.

NOTE: I've started using xsd.exe /c using the .NET Framework Beta 2.0 because it creates properties instead of public fields. Maybe that's too anal, but it gives me a warm fuzzy so I'm running with it. The only tweaks I have to make is to remove the “partial” in the partial classes and remove the AnonymousType parameter from the XmlTypeAttribute on the class.

However, I'm not creating this post to discuss what I'm doing necessarily. The real driver is an excellent post I read by John Cavnar-Johnson today...and it hits close to home. He points out (with respect to developing distributed services) that you should “design your systems around messages, not objects.” Well, I knew that much already. What I did not know, as stated in his guidance summary is that you shouldn't use .NET Remoting and you shouldn't use COM+ and Enterprise Services unless you have to. No pain to me - I've used ES to create a queued component and wrote a binary over TCP-based remoting component a few years ago, but that's about it for real-production code...Either way, it's nice to get a bold stance on the subject. There are definitely a lot of conflicting opinions and the varying information is mind-numbing. He also suggests using System.Messaging (MSMQ) “for reliable communication between tiers under your control.” BizTalk, of course, is mentioned. Personally, I think BizTalk 2004 is very slick, but takes a lot of work to get your arms around it. However, I've had zero clients who were willing to purchase the expensive licenses for BizTalk.

Furthermore, another interesting post by Ted Neward got me thinking about this subject as well. Personally, I think if I merged a few words from his post a few from John's post, I could combine them to create the quote of the year, decade, and maybe the century...

"There is no such thing as a good distributed object model. Distributed objects suck. They sucked 10 years ago, they suck today, they'll suck 10 years from now."

This reminded me of when I read Martin Fowler's book Patterns of Enterprise Application Architecture and his First Law of Distributed Object Design.

So my question is...Where is Indigo...err, I mean Windows Communication Foundation going to fit into this debate?  :-)

 


Digg!

posted on Friday, August 05, 2005 9:14 PM

Feedback

# re: Yet another post on the contract-first aproach 8/10/2005 11:23 PM Martijn Veldkamp

XsdObjectGen from msdn is working like a charm for those projects who are based on .Net 1.1 framework.

# re: Yet another post on the contract-first aproach 8/11/2005 11:24 AM Sean Chase

Good to know! I was considering using that as well. I figured I might be safer using the Visual Studio tools, so I'm glad to hear it is working out for you.