The virtue of contract-first

Service Station, by Aaron Skonnard

Syndication

I love being challenged on my opinions. I've been challenged extensively regarding my opinion on contract-first development, although mostly by folks at Microsoft like Don, Doug, and Dare. The funny thing is when I have the same discussions with folks in the field building systems today, it's a no-brainer.
 
So why the disconnect between vendors and the rest of the world?
 
I believe it's because most vendors don't see (or appreciate) the main virtue of the contract-first approach, which has more to do with collaboration than interoperability. The latter is a result of the former. Let me explain.
 
Interoperability is the net result of a well-designed contract. By "well-designed" I mean a contract that experiences fewer interoperability issues when used across a variety of toolkits. Simply using contract-first does not guarantee a good contract. However, increased collaboration during contract does. This means getting all parties (everyone who will have to deal with the contract) involved early, during design, so you can identify what will and won't work in each implementation environment. This allows you to bring local expertise to the table early in the process before the implementation investment begins. This process influences the subset of XSD constructs that can be safely used given the identified limitations.
 
Contract-first is the only way I know of to employ this type of process and it's the primary motivation for doing so. Code-first, on the other hand, is self-centered and discourages collaboration.
 
Obviously there are situations where you cannot collaborate with all your consumers ahead of time, but in many of the common enterprise integration scenarios you can. When you can't, one should definitely stick to a subset of XSD that will be most likely to work with as many possible consumers. These subsets, however, are just the documented best practices that came from the type of collaboration I described above.
 
I believe the other reason for the general disconnect is that vendors believe that developers don't want to work with anything but objects. They believe that developers don't want to author service contracts directly. They believe it's too hard. So instead of trying to make it easier through tools, they turn to objects instead. Ironically this is the reason for the impedance mismatch problems that cause so many of the interop problems to begin with. It's this general attitude that causes many of us to "shake our heads in sorrow". I believe vendors got this wrong - there are many developers who would quickly embrace working this way if they were only given the proper tool support.
 
In fact, I believe this is one of the reasons BizTalk is starting to take off. BTS is the first MS technology that breaks the mold and doesn't try to hide XML messages behind an object facade. Instead they've tried to improve the XSD-driven developer experience through better tools and they've done a great job at it. BTS acknowledges that successful integration is built on these principles and contract-first, along with message-orientation in general, is the way to go. Contract design is step #1 in developing a BizTalk solution.
 
In the end, contract-first encourages and enhances XSD-focused collaboration, instead of the "let's just ignore it and hope it works" attitude which discourages it, and as a result, hurts interoperability.
 

Posted Apr 25 2005, 06:30 PM by Aaron Skonnard
Filed under:

Comments

Dare Obasanjo aka Carnage4Life wrote More on Contract-First Web Service Design
on 04-26-2005 7:52 AM
Simon Fell > Its just code wrote Dare on contract first
on 04-26-2005 9:58 AM
In More on Contract-First Web Service Design Dare responds to a post from Aaron, skipping to the bottom of Dare's post, I hope he remembers that the #1 interop killer is that in .NET 1.1 value types can't be null when he's doing his code first design. Dare goes onto say "
With these guidelines our developers can build XML Web Service applications in a 'code first' manner yet have a high degree of confidence that the services we build will be interoperable across various toolkits." Surely someone with deep knowledge of XSD & WSDL put these guidelines together, no? Perhaps that WS-I profile for XSD is good thing after all
Service Station, by Aaron Skonnard wrote Is BizTalk Rocky's
on 04-26-2005 11:54 AM
Girish Bharadwaj wrote Conversations about Contract-First Design
on 04-26-2005 7:42 PM
Mark Bower wrote re: The virtue of contract-first
on 04-26-2005 11:36 PM
I'm with Aaron on this one. I think Dare and Don's comments show very little understanding of how enterprises manage their software development. Architects are interested in designing the interfaces between systems. Tell them to go write objects first and they will laugh you out of the building. They want to leave the detail of the internal implementation to Dev leads/Designers, but do want to make sure the interface is 'right'. They have the knowledge and expertise to know what makes a good and bad interface, but want the tools to enable them to do that. Right now I see people hand-crafting this, or using something like XML Spy. What we at Microsoft need to create is a first class contract design tool built into Visual Studio Architect Edition. I was hoping the Indigo release would add something like this, but if Don's comments are anything to go by, we will be dissapointed :(
notgartner.com: Mitch Denny's Blog wrote SOA and Interoperability
on 04-27-2005 4:26 AM
Dion Hinchcliffe's Blog - Musings and Ruminations wrote It's all about real interoperability: REST vs. SOAP redux
on 04-27-2005 8:40 AM
CraigBlog wrote Contract First? Code First? Both First.
on 04-27-2005 10:34 AM
Vern DeHaven wrote re: The virtue of contract-first
on 05-03-2005 12:19 PM
I can only speak from personal experience here... I agree with Aaron as well. We've been building our services contract-first for a couple years now. The biggest benefit has been how easy it is to collaborate with all parties, technical and non-technical during the architectural phase. We can graphically show (with XMLSpy) the business owners our data structures and quickly change them while we talk with them. We seem to automatically get interoperability; we've have had no issues with repect to this yet. If VS.NET were to include a tool to build WSDLs such as CapeClear's incredible SOA Editor, world domination would be complete!
Todd Biske wrote re: The virtue of contract-first
on 05-04-2005 4:53 AM
Aaron-

I really enjoy reading your posts on contract first and BizTalk. I've posted a response to your comments on my blog at http://www.biske.com/blog/. While I agree with all your opinions, I think the reasons for the current state of affairs are a bit different.
eXtensible mind wrote Contract-first vs code-first bullshit again
on 05-09-2005 12:21 AM
eXtensible mind wrote Religious, unproductive and useless contract-first vs code-first discussions again
on 05-09-2005 10:34 AM
Vern DeHaven wrote re: The virtue of contract-first
on 05-17-2005 4:24 AM
There's really nothing religious about it. We get the job done by starting in the middle of the "Java <-> Axis <-> XML <-> HTTP <-> XML <-> System.Xml.Serialization <-> ASP.NET <-> C#" technology line that Craig laid out. I have yet to come across a toolkit that allows us to start at one end and get a well-written, er, -generated, WSDL out of it. They all create vague and, consequently, useless interface definitions. If the generators improve in the future, I would use them. No religion...I have no need to remain faithful to any technology.

If you take your time, you can learn WSDL. It is a very powerful technology that can save you many lines of code. Validating SOAP against the WSDL's schema alone is worth it. I know it's this big scary beast on the outside, but it's Silly Putty (TM) on the inside, conforming to your every whim.

This is both productive and useful.

This has been a secular post.
Commonality wrote Developing Distributed Services
on 08-05-2005 6:44 AM
I'm glad someone else brings this to the table. John Cavnar-Johnson puts it very nicely, and I totally agree with...
Commonality wrote Get To know thy BizTalk
on 08-10-2005 8:37 PM
Recently, some prominent people have started (or, most likely, are just now talking about it) about BizTalk Server, some in...
Christopher Steen wrote Links from CMAP Architect Group Meeting on Tuesday, January 18th
on 01-17-2006 11:09 PM
Links from CMAP Architect Group Meeting on Tuesday, January 18thTopics: Developing Web Services
Using...
TheChaseMan's Frenetic SoapBox wrote Contract First: Why are messages being translated into NULL objects in VS2005?
on 10-12-2006 12:14 PM
VIctor Moran wrote re: The virtue of contract-first
on 04-03-2008 3:01 PM
I think 1 of the big issues being skirted in this discussion is the fact that vendos want to push poduct. In the case of Microsoft, the more they cankeep you in their environment, the fewer 3rd-party tools you'd need to use (many of which far exceed MS's proficiency or desire to be in a market), the greater the long-term dependency on them.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?