Re: A searchable datastructure for represeting attributes?
Date: Fri, 1 Mar 2002 00:30:58 +0100
Message-ID: <a5mei0$g7i$00$1_at_news.t-online.com>
--CELKO-- wrote:
> The short answer is "No" and the long answer is that you are
> committing what I call "The OO Programmer's Mistakes" now that I have
> had to clean it up a few times. Your first approach is a
> META-DATABASE model trying to wedge itself into a DATABASE. It just
> don't work!!
Reading this very nice thread, I can only support Joe's opinion.
A relational database is optimized for querying for relations. Storing all "objects" or "object attributes" into one table is always bound to become a desaster. Don't even think about it.
There is a very nice analogy on the OO programmers side: People modelling META-CLASSES in programming languages:
class MetaClass{
String name;
MetaAttribute[] attributes;
}
class MetaAttribute{
String name;
Object value;
}
In November I had to spend about 50 emails fighting a team of 4 developers to prevent the above.
The simple solution for both META-BLUNDERS:
- Create your relational tables dynamically from your object
attributes. Every database engine supports a CREATE TABLE
statement. It's a little tricky to reengineer a table by
copying the data to a temporary table, dropping the table
and recreating it but that's only a days work. With this
approach, some constraints will be tricky but your approach
has none at all.
- Create your classes dynamically. Speaking for Java, you can
either write .Java files and compile them or use a bytecode
engineering library like BCEL.
> You want a persistent object store of some sort. I don't know if
> anyone hs such a thing that can be accessed easily, to be honest. Do
> not do this in SQL.
Here gos:
db4o - database for objects
http://www.db4o.com
Kind regards,
Carl
Received on Fri Mar 01 2002 - 00:30:58 CET