Hi all,

I'm relatively new to OODB and in particular Elephant. I learn best by working with applications, so normally, I would try to migrate something I have done in a different application into the new environment I'm learning.

For this exercise, I'd like to migrate an application I developed in a different environment using MySQL. It's a small invoicing application.

The concept I'm trying to visualize, for both design, efficiency, and performance, is the following (very simplified version):

I have many customers who place many orders. The orders get eventually shipped and converted to invoices. Invoices can receive full payment or many partial payments, etc, etc. You guys get the idea.

Coming from a relational world, I would have something like a customers table, an orders table with order_items, invoices with invoice_items, maybe something like transactions, etc.

I would be able to query all customers, or get gross sales or gross payment reports, as well as look up any customer and get individual order history, invoice history, etc.

So, in my mind, in terms of architecting this, I could do something like a collection of customers where each customer object would have a a few slots. One for orders which will in turn a have collection of items. Another for invoices, which will have another for its items, and so on and so forth.

That setup, I would think, would give me a nice model for looking up a client and then pulling its corresponding historical records. However, it would seem to me that if I then wanted to run a gross sales or gross collections report, I would need to iterate through all customers to get the corresponding data to possible then select specific date ranges or other filter criteria. That to me sounds extremely inefficient.

Now, that could be just because that's the way OODB work in general or because I have a completely wrong design on what I should do.

The other approach I thought would be to model it similarly as to how I would do it in a relational database. Basically, I would create separate collections of objects representing the tables I would have in the relational database. Then, within each object, e.g. a customer object, I would create a reference to a collection that holds a subset of invoices, for example. This would allow me to simply query the invoices collection of a customer and that's it. At the same time, I would be able to query the entire invoices collection.

This sounds like a better approach. However, I'm wondering if anyone could comment on the overall design, and even possibly provide some sample code or pseudocode on achieving it.

Thanks,
Daniel

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to