John: excellent news!! I really like the different persistence alternatives we have in Squeak :)

A couple of questions:

1) Which is the difference between Moe and Roe. I ask because here: http://www.seaside.st/documentation/persistence#185450097 I saw Roe.

2) Which are the advantages and disadvantages of Moe over other Magritte related stuff like Magritte-RDB for example ?

3) Is this project similar to SqueakSave? http://www.hpi.uni-potsdam.de/hirschfeld/projects/sqsave/index.html

Thanks and congratulations for the work!


ps: if you have to user another database instead of postgres, you know there is SqueakDBX  ;)


On Thu, Jul 16, 2009 at 1:43 AM, John McKeon <p3anoman@gmail.com> wrote:
Moe is a databse persistency framework based which uses Magritte and Roe for persisting objects to PostgreSQL db's. The one novel thing about it (and I am sure I can't be the first person to have thought of it) is that, instead of serializing contained objects to the db column for that object,  it stores the id of any embedded/persisted object in the db column for that object and rebuilds the object with its embeddded objects on reload. It works for embedded collections as well writing an integer array to the db column to represent the collection in the db. Its a relatively simple and somewhat naive framwork written by a newbie :) I like to think of it as an Inactive Record Pattern in that Active Record Pattern requires the objects to (somewhat) model the database, and requires you to implement the database features (like foreign keys) in the object model. The philosophy of Moe is to use the db as a mirror of the model objects. Where there is a collection in the model the db should also have a collection, etc. I don't use any kind of foreign key relations in my objects so I wht should I bother with them at all. Best of all, it is all implemented using Magritte meta descriptons.

Along with this the Postgres package has been modified to include integer array support.

I also needed to implement money columns so I added support for the money type in postgres and used Avi Bryants Money package from squeaksource to model money types. Support has been added for reading a string representation of money replete with Locale defined separators and decimals.

The money implementation required that I write a new Magritte description so Magritte-Money is now available in the Magritte-Addons project. Again, to use this you will need to load the Money package.

The following packages will be required to use Moe:
   PostgresV2
   Roe
   Magritte-Roe
and incidentally Money and Magritte-Money
(you can get away with not using Money by using the previous version of PostgresV2)

Lastly, I have always been dissappointed in the strictly vertical rendering of Magritte described objects and decided to implement a renderer that would give them a more horizontal feel. MARowRenderer will group your descriptions based on their priorities. Priorities 1-9 will render on one row, 10-19 on the next row, 20-29 on the next row and so on. Its a little kludgy, and the algorithm needs some work to make it more efficient, but it works well. Column spans are also calculated so rows do not have to have the same number of elements to look good. If you've ever wished you could get the person's Last Name, First Name and Middle Name to render on one row, and the address fields to render on their own row etc, this will do the trick. Simply implement descriptionContainer on your object to return MARowContainer and voila!

I hope the community finds some of this stuff useful.
John McKeon



--
http://jmck.seasidehosting.st

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki