Re: Databinding - Best Practice (object-oriented)

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Grant Frisken (gfrisken.minusspam_at_optusnet.com.au)
Date: 06/06/04


Date: Mon, 7 Jun 2004 09:19:32 +1000


"Alfredo Novoa" <alfredo@nospam.es> wrote in message
news:40c385db.18444381@msnews.microsoft.com...
> On Sun, 6 Jun 2004 14:39:00 +1000, "Grant Frisken"
> <gfrisken.minusspam@optusnet.com.au> wrote:
>
> >ADO.NET is one way of mapping a relational database into an object
oriented
> >space. For my money it suffers from the fact that it is a very thin
> >mapping that means your application code is very exposed to the actual
> >database structure.
>
> No, you are wrong. The actual database structure is hidden by the SQL
> DBMS. Your application code is not exposed to the internal data
> structures used by the DBMS.

I meant of course that your code is exposed to the relational model - which
is in general a different way of looking at the problem domain then many OO
designers would use. This is not to say that it is necessarily better or
worse - just different - and when using object oriented design and languages
there is an impedance mismatch between the two models. ADO.NET does
nothing to address this, it just maps the relational model into objects
which results, in my view, in a somewhat unnatural object oriented usage if
you choose to use this model directly throughout your code.

> > It also results in objects which are fairly
> >"unnatural" for purist OO designers - that is the objects "Tables, Rows"
> >have no real basis in the domain.
>
> A table represents a set of true logical propositions. If the table is
> well designed it has all to do with the "domain".
>
> >Implementing a fatter OO mapping layer does take some more work (mostly
> >boiler plate code) in the data layer - although there are several
commercial
> >and free OO Relational mapping products available that do this
> >automatically.
>
> And all of them I know make great blunders. For instance most of them
> identify tables with classes.

This doesn't have to be the case. I've developed OO/Relational mappings in
the past which allow much more sophisticated mapping then one class = one
table. I agree that the tools that attempt to auto generate a relational
structure from an OO hierarchy based on such simple heuristics tend to
produce very ugly and inefficient database structures (just as I believe
direct mapping of a relational database structure into object oriented
design tends to produce ugly object oriented code). The two layers, in my
view, need to be designed somewhat independantly to maximise the strengths
of both technologies.

> > But I think the work is worth it because it allows the bulk
>
> I agree on that a good replacement for ADO.NET would worth the work.
> The best I know is here: www.alphora.com
>
I see you have pushed this product several times - you wouldn't happen to
have a financial interest in it would you :-)

> >of your application to be isolated from the exact implementation details
of
> >the data layer and makes this code much cleaner and easy to understand.
>
> As I said before all DBMSs already do that.

You appear to come from a very strong DMBS background - which means that you
are probably very comfortable using this model throughout your code.
Others will prefer to work with an application model that is closer to the
design modelling that they do (which typically will not include tables,
relations and rows etc as first order objects).

Regards

Grant



Relevant Pages

  • Re: Databinding - Best Practice (object-oriented)
    ... >>ADO.NET is one way of mapping a relational database into an object ... >>mapping that means your application code is very exposed to the actual ... The actual database structure is hidden by the SQL ... design tends to produce ugly object oriented code). ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Max Controls on a Single Form.
    ... "Roger Carlson" wrote: ... > Normalization and good Database Design methodology. ... > A very good book is: Database Design for Mere Mortals by Michael Hernandez ...
    (microsoft.public.access.forms)
  • Re: How to make mulitlingual website?
    ... you shouldn't normalise. ... I am QUITE familiar with database normalization and denormalization. ... you do have poor design because adding a new language requires you to change the database structure. ...
    (comp.lang.php)
  • Re: Design question
    ... >> in the mapping file as well as in the database. ... WHat would be a good design pattern ... You only need to map types to tables, ... there's plenty of OR mapping tools around - partly free. ...
    (comp.object)
  • Re: ID field as logical address
    ... Date and Darwen's notions that a database is a collection of relvars ... We therefore choose a range of surrogate keys which can be manipulated as ... In some cases we have natural keys where the mapping is enforced by ... see the assignment has having been done by their programs. ...
    (comp.databases.theory)