comp.lang.ada
 help / color / mirror / Atom feed
From: Ole-Hjalmar Kristensen <ole-hjalmar.kristensen@substitute_employer_here.com>
Subject: Re: Windows Ada database support.
Date: 09 Dec 2004 13:22:15 +0100
Date: 2004-12-09T12:22:20+00:00	[thread overview]
Message-ID: <wvbrk6rroe4o.fsf@sun.com> (raw)
In-Reply-To: 1bucyi24j39vb.14y21qffgez47.dlg@40tude.net

>>>>> "DAK" == Dmitry A Kazakov <mailbox@dmitry-kazakov.de> writes:

<snip>

    >> 
    >> Dmitry, what is your plan the other way round, i.e. how do you
    >> make data related expressions for some nice higher level abstraction?

    DAK> You have cunningly formulated the problem so that there is no higher level!
    DAK> (:-)) There is either:

    DAK> for I in S'Range loop
    DAK>    if S (I).Key in 100..200 then
    DAK>       for J in T'Range loop
    DAK>          if T (J).Foo = S (I).Key then
    DAK>             Append (Result, S (I).Key, T (J).Foo);
    DAK>          end if;
    DAK>       end loop;
    DAK>    end if;
    DAK> end loop;

    DAK> or you define "*" (product) for the type Table'Class (of S and T) + other
    DAK> operations to extract sets from the tables.

    DAK> But the question is why an application should always organize its data in a
    DAK> way which could require implementation these, very expensive, operations?
    DAK> Isn't it so that tabular view just forces global container operations? When
    DAK> we write in Ada we avoid global operations. How often you copy an array in
    DAK> Ada (except String<->Unbounded_String conversion (:-))? Merge two arrays?
    DAK> Isn't S and T just a two-dimensional array?

Yes, and you have generic tools to follow relations (join). But There
*are* reasons for organizing your data this way *in the database*.
This organization is very flexible, but as you observe, may be
expensive. SQL compilers have do do lots of optimizations to allow
efficient execution of complex queries, especially since a large
database is orders of magnitude bigger than the amount of available
memory. The basic idea is that you organize your data in a way that
captures the aspects that are inherent to the data domain itself, not
specific to any particular application. This data model (the
conceptual schema) can then support a very large set of different
applications with no need to reorganize the data model. This is much
more flexible than the old network databases, where the access paths
(indices, pointers) were hard-coded into the data model, giving
excellent performance for some applications, and absolutely abysmal
for others, in addition to being hard to maintain. In the three-schema
architecture, each different application is then supported by a
different external schema, typically a subset or a transformation of
the conceptual schema. The application itself need not organize its
internal structures as tables, but having a sound conceptual view and
a normalized structure is really a necessity if your database is going
to support a multitude of applications. This line of thinking
obviously originates from corporate databases and the like, where
there is a need to maintain a large body of data *independently* of
the applications which may happen to use them. I think you see the
similarites between the three-schema architecture and the rapid
prototyping tool I described earlier. It is not a coincidence :-)

Now think of this: *IF* set operations were supported by the
programming language, wouldn't it be a convenient way of structuring
your code (efficiency considerations aside)? Example: I want to update
the salaries of all employees with a specific manager, or I want to
see which projects an employee has worked on in the last month, or
find the sum of all hours employees working for a specific manager has
worked on a specific project. These are all problems which can be
trivially solved using sets. No navigation or hard-coded links
necessary, no need to create objects which maintain the relation
links, no need to add new classes when you want to add a new relation
between objects or when your relation changes from on-to-one to
one-to-many or many-to many. This is taken care of by modyfying the
integrity constraints of your schema. The inherent relations in your
problem remains the same whether you prefer a solution with explicit
links (the most typical for object-oriented solutions, in my
experience), or a tabular organization, in which case you will most
likely use the DBMS engine to do the bulk of the processing. One way
of looking at the difference is that with a tabular organization the
application is free (via set operations) to follow or update any
thinkable relation, limited only by the integrity constraints, while
in an object-oriented or network system, you will typically have
materialized those relations you are interested in, and the
constraints are implicit in your materialization. 

But there clearly is a mismatch between the facilites provided by the
RDBMS and your typical programming language, I am just unsure what is
the best way to bridge that gap.

    DAK> -- 
    DAK> Regards,
    DAK> Dmitry A. Kazakov
    DAK> http://www.dmitry-kazakov.de

-- 
   C++: The power, elegance and simplicity of a hand grenade.



  parent reply	other threads:[~2004-12-09 12:22 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-24 12:31 Windows Ada database support Mark Doherty
2004-11-24 15:04 ` Marius Amado Alves
2004-11-24 18:35 ` Pascal Obry
2004-11-24 19:17   ` Alex R. Mosteo
2004-11-24 19:30     ` Dmitry A. Kazakov
2004-11-24 22:32       ` Ching Bon Lam
2004-11-25  1:03 ` David Botton
2004-11-25 17:50   ` Warren W. Gay VE3WWG
2004-11-26  9:15     ` Dmitry A. Kazakov
2004-11-26 18:36       ` David Botton
2004-11-27  8:59         ` Dmitry A. Kazakov
2004-11-28  0:46           ` David Botton
2004-11-28  9:51             ` Dmitry A. Kazakov
2004-11-28 10:23               ` Pascal Obry
2004-11-28 11:03                 ` Dmitry A. Kazakov
2004-11-28 14:38                   ` Martin Dowie
2004-11-28 16:51                     ` Marius Amado Alves
2004-11-28 19:50                       ` Martin Dowie
2004-11-28 20:49                       ` Christopher Browne
2004-11-28 17:29                     ` Dmitry A. Kazakov
2004-11-28 17:47                       ` Marius Amado Alves
2004-11-28 18:56                         ` Dmitry A. Kazakov
2004-12-06 14:57                           ` Warren W. Gay VE3WWG
2004-11-28 18:45                   ` Pascal Obry
2004-11-28 19:13                     ` Dmitry A. Kazakov
2004-11-28 20:04                       ` Pascal Obry
2004-11-29  9:04                         ` Dmitry A. Kazakov
2004-11-29 10:07                         ` Adrien Plisson
2004-11-29 11:00                           ` Alex R. Mosteo
2004-11-29 13:12                             ` Frank Piron
2004-12-01 16:19                           ` Pascal Obry
2004-12-02 10:37                             ` Marius Amado Alves
2004-12-02 10:58                               ` Frank Piron
2004-12-03  2:50                               ` John B. Matthews
2004-11-28 20:36                     ` Marius Amado Alves
2004-11-29  1:40                       ` Georg Bauhaus
2004-11-29 10:30                         ` Marius Amado Alves
2004-11-29  1:28       ` Georg Bauhaus
2004-11-29  8:53         ` Dmitry A. Kazakov
2004-11-29 11:09           ` Georg Bauhaus
2004-11-29 12:01             ` Dmitry A. Kazakov
2004-11-29 14:07               ` Georg Bauhaus
2004-11-29 18:04                 ` Dmitry A. Kazakov
2004-11-29 22:05                   ` Georg Bauhaus
2004-11-30 11:00                     ` Dmitry A. Kazakov
2004-11-30 13:46                       ` Ole-Hjalmar Kristensen
2004-11-30 15:04                         ` Dmitry A. Kazakov
2004-11-30 16:09                         ` Georg Bauhaus
2004-11-30 16:07                       ` Georg Bauhaus
2004-11-30 18:52                         ` Dmitry A. Kazakov
2004-11-30 21:10                           ` Georg Bauhaus
2004-12-01  9:11                             ` Dmitry A. Kazakov
2004-11-29 12:56       ` Marius Amado Alves
2004-11-29 13:26         ` Dmitry A. Kazakov
2004-11-29 15:02       ` Frank Piron
2004-11-29 15:58         ` Marius Amado Alves
2004-11-29 18:16         ` Dmitry A. Kazakov
2004-11-30  7:14           ` Frank Piron
2004-12-06 14:48       ` Warren W. Gay VE3WWG
2004-12-06 16:29         ` Dmitry A. Kazakov
2004-12-06 17:52           ` Warren W. Gay VE3WWG
2004-12-06 19:44             ` Georg Bauhaus
2004-12-06 20:49             ` Dmitry A. Kazakov
2004-12-07  5:16               ` Warren W. Gay VE3WWG
2004-12-07 10:29                 ` Dmitry A. Kazakov
2004-12-07 15:49               ` Georg Bauhaus
2004-12-07 21:29                 ` Dmitry A. Kazakov
2004-12-08  2:24                   ` Georg Bauhaus
2004-12-08  9:05                     ` Dmitry A. Kazakov
2004-12-08 10:03                       ` Ole-Hjalmar Kristensen
2004-12-08 10:56                         ` Dmitry A. Kazakov
2004-12-08 11:19                           ` Marius Amado Alves
2004-12-08 12:51                             ` Frank Piron
2004-12-08 13:43                               ` Dmitry A. Kazakov
2004-12-08 13:41                             ` Dmitry A. Kazakov
2004-12-08 16:09                               ` Georg Bauhaus
2004-12-08 19:46                                 ` Dmitry A. Kazakov
2004-12-09 12:20                                   ` Georg Bauhaus
2004-12-09 12:59                                     ` Dmitry A. Kazakov
2004-12-08 15:58                           ` Georg Bauhaus
2004-12-08 19:43                             ` Dmitry A. Kazakov
2004-12-09 11:58                               ` Georg Bauhaus
2004-12-09 13:27                                 ` Dmitry A. Kazakov
2004-12-09 18:58                                   ` Georg Bauhaus
2004-12-10 10:22                                     ` Dmitry A. Kazakov
2004-12-10 14:28                                       ` Georg Bauhaus
2004-12-10 15:14                                         ` Dmitry A. Kazakov
2004-12-08 15:52                         ` Georg Bauhaus
2004-12-08 20:22                           ` Dmitry A. Kazakov
2004-12-09 12:12                             ` Georg Bauhaus
2004-12-09 12:59                               ` Dmitry A. Kazakov
2004-12-09 18:45                                 ` Georg Bauhaus
2004-12-09 12:22                             ` Ole-Hjalmar Kristensen [this message]
2004-12-09 14:03                               ` Dmitry A. Kazakov
2004-12-10 20:47                   ` Simon Wright
2004-11-25  2:18 ` bubble
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox