Re: OO versus RDB
- From: "David Barrett-Lennard" <davidbl@xxxxxxxxxxxx>
- Date: 17 Jun 2006 07:59:53 -0700
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).
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. Implicit in the binding to variable F is that F is fixed. A
set isn't allowed to change without becoming a different set! In that
sense the "pure" relational model doesn't try to model assertion of new
facts and retraction of existing facts. Rather, it is only concerned
with how to retrieve "derived" information from a given snapshot in
time of the database.
Is this the sense in which you are limiting the usefulness of RM? 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.
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.
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". This is the only way to write OO
programs that are correct. Unfortunately, the reality is that just
about all large OO projects contain lots of bugs, because 100% correct
OO is almost extremely difficult.
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.
Now to compensate your critique of ADTs: the problem of RM, in its current
state is its extremely low abstraction level [*]. The "strong" semantics is
a consequence of. AND/OR circuits have an extremely strong semantics of
Boolean algebra. So what? Most of nasty problems of ADTs (such as LSP,
multiple dispatch, parallel types hierarchy, etc) are problems of higher
abstractions, RM does not possess. Oh, it surely does, but it would take a
human's life to construct them there manually. When RM will become ADT (and
it surely will) that type system will face *same* problems. These problems
are fundamental, IMO.
-------------
* Your string example indicates this. But that is nothing comparable to
containers of strings, constrained strings, strings of various types of
characters, their encoding, support and construction string matching
algorithms, parsing, compiler construction etc.
Yes, we agree that RM is not the be all and end all. However, don't
you agree that it is excellent at modelling knowledge about *external*
entities - as collections of facts? Do you think OO is better at this?
I don't really understand the sense in which you say my comparison of
OO and RM is flawed. Can you elaborate?
Cheers,
David Barrett-Lennard
.
- Follow-Ups:
- Re: OO versus RDB
- From: topmind
- Re: OO versus RDB
- From: Dmitry A. Kazakov
- Re: OO versus RDB
- References:
- OO versus RDB
- From: David Barrett-Lennard
- Re: OO versus RDB
- From: Dmitry A. Kazakov
- OO versus RDB
- Prev by Date: Re: testability (Was: The wisdom of the object mentors)
- Next by Date: Re: Let's put this to rest
- Previous by thread: Re: OO versus RDB
- Next by thread: Re: OO versus RDB
- Index(es):
Relevant Pages
|