F
Frans Bouma [C# MVP]
Joanna said:Having never found a use for things like NIAM (I had to look it up to
see what it was), I can't see what you mean. I start my modelling by
defining classes that contain, not only data, but also functionality
as OO design is not just about data in isolation.
Then, if instances of that class require persisting, I then go on to
decide which attributes (data) require persisting and then map those
attributes to fields of tables in the teh OPF. Many classes in my
systems do not actually need persisting at all as they are "worker"
classes, used to manipulate other objects.
Ok, I think we then use a different approach towards creating
software. Which is perfectly fine of course, though it requires that
the proper tooling/methods are used which fit with the approach chosen.
I'm perhaps pretty old-school in this regard (Yourdon, Halpin etc.)
We find that, using our approach, employing a DBA would be serious
overkill as all the tables are created automatically, adjusted
automatically and the only SQL involved is simple Select, Update,
Insert and Delete statements
Heh

articles, you might have guessed I'm not that fond of the average
DBA-"stored procedures are the way to go" approach, though I think they
have their place, though more on the admin side, where tuning of RDBMS
parameters is required (e.g.: parameters outside the application scope,
like index bucket fill rate etc. )
Having to add foreign key fields and referential integrity
constraints into a database where they do not exist in the object
model is corrupting the original model. Relational theory was
invented to accomodate the need to store data in a relational
database. If you were able to use a well designed OODB, then you
would no longer need relational databases. Why should I have to store
the invoice lines separately from the invoice if they are an integral
part of that invoice ? Only because a relational database requires me
to do it that way.
If everything would have been as small as the sole entity, it would
indeed be the right approach. Though when I want a list of all
customer's company names and the order dates of their last orders, I
effectively create a new entity ('relation' in Codd's terms) which is a
first-class citizen of the relational model, but a bit of an ugly
stephchild in an OODB.
Also, OODBs are around for a long time now, but never gained any
ground while OO languages are around even longer, so something must
make them not really applicable to realworld scenario's.
Though I agree, if (not when) an application is fully suited with an
OODB, you don't need an o/r mapper.
I don't cut corners in class design, I use the OPF to translate the
object model into a relational one. However, due to the minimal
requirements of implementing an object storage mechanism, the
majority of what you call a "solid" relational model simply never
gets done; it is the job of the business classes themselves to
maintain inter-object integrity.
I think we disagree on that based on where we both come from and how
we look at the problem.
It looks like we must agree to differ. You seem to think that
everything has to be solved using relational modelling, whereas I
only use RDBs as a temporary store for objects.
I don't think 'everything' has to be solved with relational modeling,
I'm just practical. Just try it for a small simple customer-order etc.
app: go to http://www.orm.net (successor of NIAM), and read the basic
rules, it's very simple. You can model the reality without talking
about databases, classes or other things which map 1:1 to a technical
construct (table/class whatever). I think that's a great advantage, but
I agree with you, that we think differently and as long as we both
agree that the other approach is also doable but just 'different' it's
fine by me.

succesful, but also know that a lot of people use DDD and are very
succesful.
Certainly, we use an attribute (property/field) as the smallest
granularity.
We have been known to create database views that manage inherited
classes, so that the base/derived classes are stored in "partial"
tables linked on the instance ID. but we tend to keep most classes to
full class per table, even if that means the same columns in multiple
tables. This is an optimisation that pays off in retrieval times at
the expense of being able to easily retrieve heterogeneous lists of
all instances of a hierarchy.
though wouldn't you agree that if said database is for example also to
be used in another application not using your o/r mapper, the database
would look 'un-normalized' or 'not properly normalized' and which would
be a bit of a problem?
We have never neede NIAM/ORM, we usually start with UML class
diagrams and use case diagrams. When we have a tested, working object
model, then we look at persistence. Don't forget, in theory we could
just keep all the objects in memory as in something like Prevayler,
only writing the whole object graph to disk when the application
quits.
sure, though querying and reporting would be a big pain

We really are approaching applicaiton design from two different
directions; you from the relational driven background where the world
can be ruled by RDBs, I from the OO background where RDBs are
mere (and inefficient) slaves to the object world![]()
hehe


Cheers
Frans
--