Hi Cody:
cody said:
I've seen an Introduction on ADO.NET with its Datasets on .NET TV and Iam
now wondering how it is realized/used in real world applications.
I don't believe that one would create a dataset and add relations to it and
so on for every table in the application, this would be a real mess and this
has nothing to do with OOP.
I totally agree with the Mess part. It may or may not have something to do
with the OOP part. An object doesn't really care how it's properties get
set as long as the follow the accessor's rules.I konw that's not the point
you were making but that's why I say it may or may not have something to do
with OOP.
Datasets are composed of datatables and datatables are Two dimensional
objects. With DataRelations that can change quite a bit. However, there
are more than a few structures out there that don't fit very comfortably
into the Relational model.
There's a philosophy known as OR/M (Object Relational Mapping) that tends to
bridge this gap, and if you look at ADO.NET 2.0 ,there's an object called an
ObjectSpace that addresses your concerns. OR/M tools basically handle the
mapping of your object properties to you database schema (this is an
oversimplification but it doesn't change the point). Anyway, OR/M tools
sell b/c they do what is a real pain in the butt (see Messy) to do in many
instances.
But the problem is that any downside of DataSets inherent in Relational
Dataabases. I agree that it's not always clean and depending on your
requirements, you may end up shoving Square pegs down round holes but it's
the best we have.
Normally, would would create a class Customer, a class Invoices, Positions,
Articles and so on.
But how can this be realized using Datasets?
The devil is really in the details and the problem here is that you may have
many-to-many relationships which are a nightmare to handle with the current
model. The short answer is create four tables, link them where you can. I
can think of implementations I've worked on where this would fit right in
with the dataset model, and just as easiler think of ones that were ghastly.
It really depends on the implementation of each class, and I know that's
sounds more like an excuse than an answer, but IMHO, it's a situation where
you have to take the good with the bad.
Datasets and encapsulating data
+ hiding implemention in classes seems to be a contradiction to me.
It can certainly be but not necessarily so. Like I mentioned in the
beginning, it's not a contradiction in that the object doesn't care where
it's data comes from. A dataset whose structure can mimic the object
strucutre is a very natural fit. But I'm not going to pretend that there
aren't a bunch of situations where the implementation is awkward.
Regrettably, OOP isn't a perfect model either and not everything can be
modeled by objects (why do I get the feeling I'm opening a can of worms with
this last statement ;-) ). Rather, everything can probably be modelled,
but not elegantly. Same with DataSet.
Sorry for me stupidness but I found no example explaining this.
I think that the result is that you need to consider the tools you have at
your disposal. For years, Joins were really costly (and still are in many
situations) in most RDMBS situations in many circumstances, but that has
nothing to do with Relational theory. On the contrary. However, the
pragmatic reality made the theoritical application a 'contradiction'...
should I normalize to xNormal form or not? So many modelled tables to
performance issues over theoretical correctness even though the theory was
totally correct.
I suspect this is a similar albiet nonidentical situation. I know this is a
bit abstract of an answer but it's really hard to get more specific without
using specific instances. I'll gladly elaborate on specific examples and I
can be a lot more clear then.
Cheers,
Bill
www.devbuzz.com
www.knowdotnet.com
--
cody
[Freeware, Games and Humor]
www.deutronium.de.vu ||
www.deutronium.tk