Re: OO versus RDB




Dmitry A. Kazakov wrote:
On 17 Jun 2006 07:59:53 -0700, David Barrett-Lennard wrote:

Dmitry A. Kazakov wrote:
On 16 Jun 2006 09:56:40 -0700, David Barrett-Lennard wrote:

[ I have skipped much stuff, because the very approach to comparison of OO
and RM taken, is IMO flawed.]

father(abraham, isaac).
[...]
The strong semantics behind the relational model allows for the
database engine to support advanced forms of query. By contrast, an OO
class is usually thought of as encapsulating internal state so the
system can't know the semantics.
[...]
But when OO tries to model external entities, it loses a lot of its
appeal.

The [strong] semantics of RM is the semantics of the real world objects?
Collection of facts? What happens if some facts are wrong?

I'm not sure what you are leading to here. Non-montonic reasoning?
Naturally a database can contain errors. Therefore we need to be able
to retract facts. This merely corresponds to deleting records out of a
table. Also, we want to be able to add new facts - ie add new records,
or even new relations (ie tables or else derived relations).

No. I meant the cases where the model does not map the reality. RM applies
a definite set of models. It is obvious that these models don't fit a huge
amount of practical cases. Your example with strings is only one.

The mathematics that underpins RM formalises each relation as a set.
Eg F = the set of (Father,Child) elements - a subset of Humans X
Humans.

... given that there exists a set of Humans, which obviously is an
enormously non-trivial assumption.

Is this the sense in which you are limiting the usefulness of RM?

Set theory in no way limits RM. But set theory is not about software
construction. It can be used to formalize RM, OO, whatsoever. But it is a
very general framework, which gives no clue how to solve concrete software
engineering problems. The science that deals with that is CS. Which is in
turn quite generic, because it usually talks about Turing completeness,
decidability etc. You need much finer tools and metrics. Especially,
because we deal with finite, constrained, deterministic models of infinite,
unconstrained, uncertain, stochastic world. And as mathematics shows
constrained problems are much harder than non-constrained ones.

The bottom line is: any references to set theory are irrelevant. I know no
theory which wouldn't be based on it, well, except a conspiracy theory,
maybe. (:-)) To show superiority of RM, one should take a class of problems
and prove that they are better solved in RM. Strings are not. Power set
constriction is also not a runner. Nearest neighbour search does not shine.
Dining philosophers will hunger. Care to write a relational model of a
random generator, one of clock/time? What about reusable RM components?

Of
course I agree - (pure) RM is only concerned with the representation of
knowledge and how to query that knowledge. It is not generally
concerned with modelling a "device" that has behavior or is able to
assert new facts or retract existing facts.

As I said in other thread, there is no data at all. RM has behavior and
this is one of relational algebra + transaction issues. RM is not concerned
to expose any further behavior, just because it cannot do it in any
reasonable way...

Note that this is not a critique of Prolog or RM. It is a simple fact (:-))
that there is absolutely no semantic difference between:

1. Data base + management of
2. Knowledge base + inference rules
3. Program + CPU

Yes, I can see a sense in which that statement is correct.

Please note that in my post I wasn't suggesting that a pure OO solution
has more/less semantics than an RM solution. Obviously all solutions
to a given problem contain precise semantics. What I am saying is that
RM makes the semantics "transparent". OO tends to require lots of
comments. This is simply because RM is declarative in nature and OO is
imperative.

I disagree. My point is that RM's semantics is lower level, this is why it
is simpler. This by the way does not imply that behavior of a given set of
RM declarations could be better understood than one of OO. There are quite
trivial languages exposing extremely complex structure. Consider cellular
automata, Conway's Life, for example.

Then, OO types systems are obviously declarative. In general declarative
vs. imperative does not influence complexity or transparency. We use
declarative approach where inference / resolution is well-studied, exists,
cheap. We use imperative approach otherwise.

For example, in OO a method on a pure interface has a contract with
specific pre-conditions and post-conditions. Hopefully the programmer
has gone to the trouble to properly document these. It is often poor
attention to the contracts that leads to bugs in OO programs.

I like OO and believe it is very powerful. Furthermore, I believe the
way to achieve quality is to pay lots of attention to contracts, and
preferably use plenty of assertions to validate the software. I
believe the most important contribution of Bertrand Meyer was his
emphasis on "design by contract".

I think that the [great] idea belongs to Dijkstra. Meyer's DbC is an
application of the idea to typed systems, IMO.

This is the only way to write OO programs that are correct.

Yes, though your formulating presumes that there is any way, which is
apparently wrong. (:-))

Unfortunately, the reality is that just
about all large OO projects contain lots of bugs, because 100% correct
OO is almost extremely difficult.

Replace "OO" with "software" and we'll be in a full agreement!
Neither has anything to do with Isaac and Abraham as real mythological
(:-)) characters. Any of them might model Bible (the text of, what it
describes, what its readers believe in, what the Universe is etc) wrong.
Any of them has a sematic of its own which might or maybe not map well to
the "reality", whatever it be.

My stance is that I just don't care. To me it is important the language
abstraction level I am dealing with. This does not warranty anything but at
least gives me some hope.

Yes, you should care about how transparent is the semantics.

Transparency of simple semantics is achieved trivially. The whole RM, as it
is known in the form of SQL, is just a set of specialized containers.
Presently many OOPLs have troubles with describing such things. But I see
nothing fundamental that could prevent creation of a library of ADTs
equivalent to RM. That would close silly discussion of what is better,
transportation or horses. (:-))

I don't really understand the sense in which you say my comparison of
OO and RM is flawed. Can you elaborate?

You consider the semantics of RM/OO isolated from what it is supposed to
model. It is a form of religion. (:-)) OO fanatics suffer it as well. They
argue that OO is good because the world is OO. The world isn't either RM or
OO.

I find it difficult to respond! Despite all that youv'e said I don't
really understand your concerns with my original post. There seems to
be a lot of generic statements using ill defined terms. ie a lot of
hand waving! I can neither agree nor diasagree with what you are
saying. Rather I keep on asking myself: what point are you trying to
make? Can you please say something more specific - perhaps using a
real example?

Cheers,
David

.



Relevant Pages

  • Re: OO versus RDB
    ... The semantics of RM is the semantics of the real world objects? ... What happens if some facts are wrong? ... emphasis on "design by contract". ... containers of strings, constrained strings, strings of various types of ...
    (comp.object)
  • Re: Bush Admits Iraq Had Nothing to Do with 9/11
    ... It doesn't explain your refusal to accept simple historical facts. ... can't get beyond your own semantics to see any of it. ... --- Impeachment may not necessarily mean removal from office, ... saw the inevitability of his fate. ...
    (rec.arts.tv)
  • Re: OO versus RDB
    ... The semantics of RM is the semantics of the real world objects? ... What happens if some facts are wrong? ... RM declarations could be better understood than one of OO. ... you should care about how transparent is the semantics. ...
    (comp.object)
  • Re: OO versus RDB
    ... The semantics of RM is the semantics of the real world objects? ... What happens if some facts are wrong? ... Naturally a database can contain errors. ... Pure functional programming is also based on a similar "no updating" ...
    (comp.object)