Holger's Thoughts on Delphi

Monday, December 05, 2005

ECO and Databases

Talking to other developers I often find out that ECO is marked an "object persistence tool" which makes it possible to store objects in databases. I have been unable so far to summarize the features of ECO in one sentence, but it is definitely not a framework that is designed to make it easier to store objects of modeled classes in a database.

The reason for that is that a lot of people , like myself, automatically think of databases, tables, relations and views when working with ECO. It's not easy to wipe that from memory, but when getting started with ECO, you simply have to forget that you will persist it inside of a database later on. Let ECO take care of that. Your task, in order to reach maximum success using ECO, is to model using UML. I wrote the keyword in italics. As Jan Norden put it perfectly: The Model is The System!

Let's finish off this blog post with an example. If you persist a blog entry in a database, you'd think of the attributes that make up a blog entry. So you need
  • an author
  • a creation date
  • a title
  • and content.
Ok. So we end up with a class called "BlogEntry" in ECO with four attributes named "author", "created", "title" and "body" (I learned that database designers always call the content "body" :-) ).



Is this a proper conceptual ECO model? Yes, it is proper. But it limits your abilities. How would you list blog entries of a certain author? How would you list all blog entries of one day? "OCL expression using select" you say. Correct, but not that handy. ECO can do it easier. Let me show you this model:



Now you can list all different authors easily and what is even more important: you can change the number of possible authors with one keystroke in the model! Furthermore, rename "CreationDate" into "DateHistory" and thus make it possible to associate many dates with one blog entry. This way you can list all dates when the blog entry was modified.

Would it be possible to transfer this model to a database easily? No. But that's what we have ECO for... It's there to persist objects into databases after all, isn't it? *grin*

4 Comments:

  • I think a good description of ECO is, "object oriented database".

    By Blogger Iman, at 4:43 PM  

  • Well, in my opinion that's exactly what ECO is *not*. ECO has a persitence layer, yes - but thats just a smaller part of the whole picture.

    --
    Regards,
    Olaf

    By Anonymous Olaf, at 4:59 PM  

  • Well persistence is a smaller part of a relational database, too. There are several features of ECO that map to a relational DB. SQL->OCL, Relational Theory->OO Theory, modeling tools, transactions...

    By Blogger Iman, at 8:01 PM  

  • Iman,
    now I get what you mean. But be careful "object oriented databases" are another category of databases - just like relational databases. What you refer to is a "database management system". I agree that ECO encapsulates many features of a DBMS, however, it is still so much more!

    By Blogger Holger, at 8:20 PM  

Post a Comment

Links to this post:

Create a Link

<< Home