Lets Talk About XML and ADO.NET
As I've been reading posts on various sites over the past 6 months I noticed a slight change in the way people address ADO.NET datasets. Last year it was all about accessing information from a DB and storing it in datasets, while lately I see more references to reading XML files into datasets.
My personal feeling is that many articles are written by folks who come from a scripting / web dev angle and miss the bigger picture that NET makes available. Time and again I see the equivalent of 2 tier designs in which datasets are pressed into the service that is normaly reserved for business objects, and vital business logic is pushed into the presentation layer. Lets face it, "code-behind" in aspx files makes that very appealing.
The key point to remember is that a dataset is an "in memory copy of the db tier" for lack of better words. It contains a stored proc result set or tables, relationships metadata etc. It is not a business object.
Why would you want to design a 2 tier system in which your web pages are driven by datasets? The Internet is full of examples that list a web page / control calling ADO. That approach might have worked in the days of classic ASP where it was actually possible to write a web page that performed faster than VB/COM (because of threading and marshalling etc), but it is not good design practice in .NET.
Personally I see a much greater value in properly modeling a given business into a set of objects that embody a good application architecture, rather than substituting this model with the built in functionality offered by ADO.NET datasets.
Some might argue that using strongly typed datasets can accomplish the same goals as a business object tier. But what is being strongly typed? A Table or a stored procedure! Proper business objects are often composed of the contents of several datatier elements - several stored procs and tables , for example an invoice with line items. It is the rarest of circumstances when you have a 1-1 mapping between a table and an object. See the difference? I sure hope I'm not missing something vital here.
Until the release of ObjectSpaces I will continue to hold fast to my idea. After the release of Object Spaces I will re-evaluate. And as far as XML is concerned, you don't necessarily need a dataset to serialize an object - do you? Anyway, I have a feeling that no matter what, in the last analysis a properly developed model of an application may include more work than many developers would want to undertake, which makes the datasets and 2 tier web development all the more inviting.....