Re: Decline of Science: Computer Science and Databases

From: Lauri Pietarinen <lauri.pietarinen_at_atbusiness.com>
Date: 8 Nov 2002 23:47:17 -0800
Message-ID: <e9d83568.0211082347.7bfe2448_at_posting.google.com>


Carl,

With all due respect your OO-version of the Group by query looks pretty complex. And I was just warming up!

Some other remarks:

  1. The SQL-query can be done a step at a time using an SQL-editor. Type in the query - press execute - look at the result - modify query - etc... until you are satisfied

The OO-approach would require compiling and running the program

2) My understanding is that ˙our implementation always fixes the order in which the objects are traversed - in the SQL-apporach the order is determined by the optimiser "on the fly".

Making a small change in the query could result in a completely different access path, e.g.   

select c.customer_name,

       product_name,
       sum(order_quantity) as total_quantity,
       sum(order_quantity*product_price) as total_price
from customer c,
     order o,
     product p
where c.customer_id = o.customer_id and
      o.product_id = p.product_id and
      c.state = 'CA'  <<--- note this change
group by c.customer_name,
         p.product_name
order by customer_name,
         total_price desc;

Now the optimiser could choose to start from the customer-table instead. The OO-approach would require a total rewrite. What's more, the optimiser can be sensitive to such issues as how much does 'CA' represent of the whole customer base and make the optimising decision according to that fact, again, "on the fly".

It can choose a different access path for

select ...
  from customer
  where name = 'Von Guggelboegel'

and

select ...

   from customer
   where name = 'Smith'

<You may be right for computers but computer programs <are still written by humans and not by computers.

However, computers are about automating things - and inorder to automate something you have to define it formally.

<Human language as in speech is the most powerful language
<we have invented so far. If we can get computers to
<understand it, we will be more efficient programmers.

That is a BIG IF!

<If you have a complex rule, your rule statement may
<be 15 monitor pages long and nobody will be able to
<maintain it.

Not necessarily true - the constraints can be built on top of each other.

Regards,

Lauri Pietarinen

>
>
> > How do you express integrity constraints? Say
> > "every order must belong to a customer and have
> > a valid product"
>
> We want to do this by using patterns:
>
> Order order = new Order();
> order.customer = new Customer();
> order.product = new Product();
>
> db.configure().ensureIntegrity(order);
>
>
> This is only design yet also.
> Example patterns like the above will be used for:
> - instantiating objects
> - updating objects
> - refreshing objects
> - deep deletes
> - locking
> - fetch groups, for better C/S performance
>
>
> [human language as an example for the ideal programming language]
> > > You build up a temporary context of small "objects" and
> > > refer to them in subsequent "methods". The "object" context
> > > is temporary and get's overridden by subsequent "objects"
> > > that overload meanings.
> >
> > Funny thing though that modern mathematics is 100% based
> > on the notion of sets and relations. I think computer systems
> > have more to do with mathematics than with natural
> > language.
>
> You may be right for computers but computer programs
> are still written by humans and not by computers.
>
> Human language as in speech is the most powerful language
> we have invented so far. If we can get computers to
> understand it, we will be more efficient programmers.
>
> And again:
> Human language is object-oriented.
> It cetainly is not relational.
>
>
> Kind regards,
> Carl
Received on Sat Nov 09 2002 - 08:47:17 CET

Original text of this message