[Fwd: Re: Magma Seaside package?]

goran at krampe.se goran at krampe.se
Wed Jan 31 23:03:01 UTC 2007


Hi!

(about to drop to bed, but a quick reply at least)

"Thierry Thelliez" <thierry.thelliez.tech at gmail.com> wrote:
> Thanks for taking the time to document some of that!
> 
> I found that there is a lot of code that could be reused in other
> applications. For example your Q2MagmaMock or Q2Log could benefit
> other applications.

Yes, the magma mock stuff and/or the session classes should be reusable.
Q2Log is trivially reusable - even though we now also have Toothpick (in
the Squeak community) as a package for logging.
I still like Q2Log. :)

> More details about the motivations behind the classes in the following
> categories could help reading the code, I think. The very high level
> intent is understandable but drilling in the details is hard.
> Q2-HV

HV is short for HttpView - it is my own web framework that I built while
Avi built Seaside. :)
We use it only for some offline functions in Gjallar - ignore it. :)

> Q2-Magma-addons

Currently holds two new index types. Magma allows creating new index
types this way. One is for "unique objects" - objects that have a UUID
in them. The other is custom for Gjallar (hence the Q2 prefix).

> Q2-Scheduler

These are the classes that implement the "cron" mechanism in Gjallar -
the ability to have recurring services wake up, run, go back to sleep.
Q2Scheduler is the actual scheduler and has its own Process, see its
class comment. To create a service you simply subclass Q2Service. We
decided to play with the concept of using the classes themselves as the
"singleton objects" for each service - so all behavior and state is on
the class side.

And yes, all this is reusable in other apps. But in order to build a
Magma/Seaside app these things are not needed. But in any complex system
you will end up with the need for "things to happen" even when a user is
not initiating it. The trivial example in Gjallar is the Q2PopService
that pops email every 10 seconds or something.

> Q2-Seaside-addons

Q2BatchedList is a special batch list that operates on a MagmaReader. It
has a class comment. Q2Canvas is a special WACanvas subclass that adds a
few "HTML building" methods - mostly for stuff like tooltips and our
forms stuff etc.

> Q2-Sessions

Holds three different session classes - Q2Session is our Seaside session
subclass which pairs a Magma session with it etc.
Q2SessionWithoutSeaside is the one we use especially when we run
Q2Services in the scheduler (no Seaside session then of course!) or when
we react on SOAP requests etc.
Q2MockSession is for running unit tests and makes especially sure that
we use a Q2MockMagmaSession - a mock Magma session.

Q2MockMagmaCollection is an attempt to "emulate" MagmaCollections, again
for unit tests. Q2MagmaSessionPool is our own implementation of a
session pool for Magma, should be reusable after cleanup.

Generally Q2Session and Q2MagmaSessionPool are the important guys here,
but typically you wouldn't need to bother with the pool - it does its
work under the covers.

> Q2-Transactions

This is very Gjallar specific. Gjallar uses a design pattern called
"Commands" (IIRC) heavily in order to be able to work offline. In other
words, whenever we change anything in the domain model we instantiate a
correct Q2Txn subclass, fill it with the correct data, let it do its
work. Then we save them in an ever longer MagmaCollection. A lot like
Prevayler or similar systems - a Gjallar system has full historic data
and should be able to replay all transactions in series and in theory
get us back to where we are.

> Q2-Utilities

A bunch of odd ends, lots of them reusable. Can't go through them in
this email. :)

> Q2-Translation

A new category created by Balazs and Levente with some mechanisms
allowing us to translate Gjallar to multiple languages. They of course
want hungarian. :) And we would probably like to do swedish eventually.

> Another area of confusion for me, not directly related to Gjallar, is
> the versioning mechanism in Squeak. I had started creating some code
> in 3.9 (learning from the Pier/Seaside/Magma application example). But
> I found hard to understand what will and will not work under 3.9
> and/or the latest Seaside/Magma versions. I guess that this comment
> belongs to another discussion list ;-)

Mmmm, not sure I can answer without more details. :)
 
> Happy badminton!
> Thierry

Thanks. :)

regards, Göran


More information about the Magma mailing list