View Single Post

  #17 (permalink)  
Old 12-20-2007
Pierre Gilquin
 
Posts: n/a
Default Re: value by default 0

Martijn ,

I just can agree on one think :
The model of an application must be in only one place but not in a mix of
both. That was the origin of my problem.
Your model is build from tables of a database and that's ok.
My model is a graph of objects and then all fonctionnalities and constaints
must be implemented at that level.
This allows me to change the persistence (from Oracle to MySql or even a
flat files or XML file) without effort.
I change my database from Oracle to mysql and I get this problem because I
forget (or loose it) to set a constraint in the object model.
Then the database was in charge and they have different behavior !
In theory a persistence is not even required but in the real world, I have
to recreate the last graph after a crash or maintenance.
In this model, there is no concept of primary and foreign key as they are
part of the actual persistence system used. It's the job of the ORM
(Object-relationnal mapping) to take care of the underlying persistence
system.
Of course, I am aware that nothing else than the ORM must access directly
the database/files.


It's not that you intend to suggest but you help me to have clearer view on
this matter.


Pierre





"Martijn Tonies" <m.tonies@upscene.removethis.com> a écrit dans le message
de news: 476a483c$0$26918$e4fe514c@dreader27.news.xs4all.nl ...
>
>> this is probably not the place for this discussion.
>>
>> But your approach is Database centric. My system is object oriented and

> the
>> database is just for object's persistence purpose only.

>
> Wrong.
>
> My approach is aimed at taking proper care of data on the lowest
> level possible in your system.
>
> This is nothing but common sense. Read Peter H Coffins post, he
> explains it in more detail.
>
> What happens if your object oriented system has faulty logic? You
> can get invalid data.
>
> What happens if "something" happens outside your program code?
> You can get invalid data.
>
> Solving this at the DBMS level is the best way to go. This, however,
> does not mean you shouldn't have decent code in place in your object
> oriented system in order to get some meaningfull error messages to
> the user and so on, nevertheless, get those checks into place!
>
> It's the right thing to do.
>
> --
> Martijn Tonies
> Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle
> &
> MS SQL Server
> Upscene Productions
> http://www.upscene.com
> My thoughts:
> http://blog.upscene.com/martijn/
> Database development questions? Check the forum!
> http://www.databasedevelopmentforum.com
>
>



Reply With Quote