Re: Mixing OO and DB
Date: Thu, 13 Mar 2008 08:33:54 -0700 (PDT)
On Mar 12, 9:14 am, S Perryman <q..._at_q.com> wrote:
> Bob Badour wrote:
> >> Robert Martin wrote:
> >>> That's fine. Consider, for example, an algorithm that finds the
> >>> minimum spanning distance of a graph. (e.g. cheapest network route, or
> >>> cheapest travel itinerary, etc). The node and edges of the graph are
> >>> stored in database tables.
> >>> Shall we execute that algorithm by doing thousands of tiny queries as
> >>> we walk from node to node through the edges? Or shall we query all the
> >>> nodes and edges in one gulp, arrange them into a graph of objects, and
> >>> walk through them that way?
> > If one studies the algorithms for minimum spanning trees, one quickly
> > sees the task involves no traversals whatsoever. In fact, one generally
> > creates the MST as a precursor to some sort of traversal, and the
> > algorithms themselves are specified in terms of sets, which makes them
> > ideal for implementing relationally.
> What about the canonical graph algorithms (breadth/depth first, transitive
> closure etc) ??
> Traversal (accessing adjacent node sets) for these happens on a per-node
> basis, does it not.
An implementation probably will, but that does not mean that graph searching cannot be *defined* declaratively. In other words, a language may have a declarative "request" but the implementation may decide to use a node-per-node processing algorithm.
> Steven Perryman
-T- Received on Thu Mar 13 2008 - 16:33:54 CET