Recently I’ve been doing some thinking about Web Services and DataSets. In particular, I’ve been thinkiing about what has encouraged folks to want to pass DataSets over the wire using Web Services.
My current thinking is that the seductiveness of databinding against DataSets in Windows Forms has exerted an unnatural bias on developers. Since there is so much friction involved in implementing databinding against collections of custom entity objects, developers have reverted to databinding against DataSets. This has led folks to marshal said DataSets over the wire using Web Services, which is against the spirit of Web Services.
Thoughts?
12 archived reader comments
Jeff Atwood (2004-07-08)
It’s the old Object/Relational mapping problem.
Aside from the databinding issue, which is huge, writing “glue” code to save objects to relational databases is incredibly tedious and error prone. So much so that we’ve reverted to sending raw datasets. It’s just LESS WORK, and it’s easier to understand and maintain. If your database is set up logically, it becomes the de facto “object model”.
The purity of code will always lose out to convenience. And deservedly so. If it’s so pure, it should be convenient, dammit!
This is basically the same thing you said here:
http://www.iunknown.com/000387.html
Except instead of “stored proc” insert the word “object”, and instead of “raw sql” insert the word “dataset”.
I will not be holding my breath for object databases to save us, either.
Andres Aguiar (2004-07-08)
Some toughts:
http://weblogs.asp.net/aaguiar/archive/2004/06/03/147208.aspx
Regards,
Andres.
Brian Broom (2004-07-08)
There is a real lack of articles and examples that don’t use the dataset construct. It is a little easier on the design side to use the DataAdapter/DataSet combo to pull from a database. I would
_love_ to see articles that give a different perspective.James Roe-Smith (2004-07-08)
I really don’t see why it is against the spirit of web services. Afterall, web services are just a way to nicely wrap up some XML and send it over the wire (with security and routing etc with WSE 2.0). If the XML is a serialised object or a DataSet does it matter?
The argument over whether a DataSet is a good thing anyway is another story. My preference is to keep “Data” related things in the data tier, so any UI binding should be against my marhsalling objects.
I guess I haven’t really cleared up much. ;-)
John Lam (2004-07-09)
James, the type system of Web Services is XSD - which only allows you to define schema. One of the four tenets of Service Orientation is to share schema not class. What does the XML of a DataSet mean to a client written in Perl?
The fact that you could hack up Perl code to “understand” the XML serialized by a DataSet is not the point here. A Perl SOAP stack would not be able to generate something that could understand the semantics of a DataSet - that’s the real problem.
Dare Obasanjo (2004-07-12)
I don’t understand what this question means. Aren’t there Perl libraries for consuming XML?
Neither would a Perl SOAP stack be able to generate something that would understand the semantics of my internal business processes if I sent it some XML generated from some of my custom objects. So what?
John Lam (2004-07-12)
Dare, The point is to take advantage of the friction-reducing nature of the SOAP stack in the first place. The SOAP stack is there to make it easier for folks to emit/consume data that is sent across the wire.
To me, DataSets add semantics that are orthogonal to business functionality - and that functionality ties you necessarily to a particular implementation.
Are you really advocating that we abandon SOAP altogether and just write RESTful implementations?
Dare Obasanjo (2004-07-12)
John, it seems you are treating SOAP as a Simple Object Access Protocol where you are invoking remote methods on objects which are passed primitive datatypes or simple objects as input and return the same as output. The problem with this approach is that when you get XML that doesn’t map to simple objects then your toolkit’s world view falls apart.
However in an SOA world you will have to deal with XML vocabularies that don’t map to simple classes and objects. You are sharing XML schemas not C#/Java/Perl/etc classes. The XML generated by serializing a DataSet is just one of many such XML vocabularies.
As I mentioned to Ted Neward in the past, if this position is difficult for you to accept perhaps you are better of using distributed object technologies such as DCOM, CORBA or Java RMI instead of using XML Web Services.
John Lam (2004-07-12)
Dare, It’s not that this position is difficult for me to accept - rather it’s a case of me trying to figure out when I should be marshaling non toolkit compatible types. Most toolkits should be able to deal with the case of marshaling arrays of structs that map onto XSD simple types. To me, this should be able to solve the 80% case of information that I would like to marshal across the wire.
I’m more interested in the 20% boundary cases - where arbitrary XML is marshaled across the wire. The cases that don’t map to types that can be [de]serialized to/from objects in SOAP toolkits. These cases impose a non-trivial amount of friction on the part of the consumers of this data. When should this happen and why?
The case of a DataSet is one such boundary case. Someone who wishes to consume that XML will have to write a custom deserializer. When should I make folks do that, and why? This is where I’m missing the “zen” of web services.
Stephen Rylander (2004-07-13)
The zen of services is definitely not in the same heart as those marshalling datasets. But thats ok in some instances. For instance, building smart apps, where the app, mobile .net of course, is speaking with a .net web service. they pass datasets, not a big deal. we’ve solved the disconnected problem, enabled remote updates, and in general got a pretty slick solution. Now, as long as on the two systems doesn’t change from the MS platform, which one should know going in, there won’t be a problem. The other side is really just can x be as generic as an apple so that y can eat it.
Dare Obasanjo (2004-07-14)
This is really up to your application and your expected consumers. If you have a business process that involves sharing WordProcessingML that you want to move to a web service then it is highly likely that you will be passing around XML documents that toolkits have no idea how to convert into object models. This is equally true for a number of schemas in the vertical industries such as XBRL, FpML, HR-XML, etc.
Max (2004-09-17)
Hi, I like to learn about the asp.Net technology, I am wondering where are you teaching? and how much the class would cost? I am currently a student, and my, and most other college don’t offer MS stuff.