I have been working on the PIM for a bit, but without the space to actually blog about it.
I started experimenting with actually code. I have been working on the basic data model classes and how well they model real-world situations. I am not yet at the point of publishing the code, but I'm starting to get to the point where I can actually think about it.
One of the things I've been working on was trying out the java persistence technology Known as DB 4O.
My intention has been to find a database storage technology that handled hierarchical data well. Relational databases manage many situations very well but even the best ORM (Object Relational Mapping) solution tends to break down when handling deep, flexible and higly modifiable hierarchies.
In order to handle the kinds of events and extensibility that I am looking for. I need to be able to store and quickly retrieve objects that are referenced from hierarchies/taxonomies where the objects themselvesstore general attributes.
To give you an example I want to be able to generate taxonomies that have a fairly deep structure ( friends-> college friends->the guys-> the wedding party) and be able to walk that taxonomy and quickly collect all the elements it points to. Then, if necessary, I would like to be able to rearrange the hierarchy. This is doable with a relational database and an ORM but no matter how carefully you balance the design, and inevitably there will be performance corner cases that are drastically inconsistent with the performance of the rest of the system.
In addition, I want users to be able tocreate their own classes of events and tasks. For example, I would like users to be able to create specific events and add their own attributes. if a user would like to distinguish between kids birthday parties and general birthday parties, they should be able to simply create a kid's birthday party event with customized properties and then be able to search within those customized properties.
Generic attributes such as this often present headaches for ORM frameworks, though not nearly as bad as managing hierarchical data.
So I was pretty sold on using a decent object storage framework. If I could find one!
DB4O has pretty much answered my requirements.
Through a mixture of byte code instrumentation and good design the DB40 folks have achieved a minimally intrusive persistence framework that effectively speeds up development, unit testing, and general maintainability of the code.
To give you a code example:
// Open the DB
ObjectContainer db;
Configuration configuration = Db4o.newConfiguration();
configuration.generateUUIDs(ConfigScope.GLOBALLY);
configuration.generateVersionNumbers(ConfigScope.GLOBALLY);
db = Db4o.openFile( configuration, filename);
//
// Create a bunch of objects (no matter how deep the hierarchy
//
List- items = methodThatCreatesAllTheObjects();
// Store the objects
db.store(items);
// Close the transaction
db.commit();
As you can see there is a minimum of explicit code by default. So I don't have to explicitly open a transaction, that is done when I attempt to store the items.
There are of course, ways to explicitly do all of the actions necessary, but so far I haven't needed to go outside of the defaults.
No comments:
Post a Comment