Magma Howto?

Chris Muller afunkyobject at yahoo.com
Wed Jul 2 03:40:00 UTC 2003


Markus Fritsche wrote:

> Say, I have a collection, where I store articles. I have an lister class
> how shows this collection to the user an gives him the possibility to
> edit a particular article. Is it right to open a session, get the
> collection, begin a transaction on opening of the editor and to commit
> it on save? How do I disconnect a session when using seaside (where it
> is not guaranteed that the user presses the 'quit' button)?

I would create web sessions and/or MagmaSessions upon the first web-client
session log-in or even just a read access from a user.  Most web applications
later terminate a session after a given period of inactivity.  This would be an
appropriate time to disconnect any associated Magma sessions.

As you read in the Magma pages on the Swiki, you want to keep transactions as
short as possible, and always avoid the scenario where a transaction is open
while waiting for user-input.  What you do is capture the user-input, open a
transaction, modify the domain objects, and commit the transaction, all in a
single feedback to the user.

> What, if two users could work on the same collections?

You need to check for commit conflicts.  For example:

[ myUserSession makeChangesToArticlesCollection ]
  on: MagmaCommitError
  do: [ : errorInfo | ... notify the user to try again ... ]

> Is there a reason for MagmaCollection not having a "fullblown"
> Collection interface (like "do:", "addAll:")?

Well, it has slowlyDo:commitEvery: which serves the same purpose as do:. 
addAll: would be easy for to implement if you need it.

The answer to your question is, perhaps, just "immaturity".  Also, that
MagmaCollections are not intended to be API-compatible with regular collections
since they really aren't truly swappable.  There are major differences in both
access mechanisms and performance.  For now the API is trying to be lean and
clean.

> Help or pointers to faq's appreciated (I've read "Getting Started with
> Magma", "Magma programming guidlines" and "About Magma Collections".

Currently, the only published documentation are those articles on the Swiki,
above, and the others they link to.  However, I'm more than happy to help any
way I can here on the list or via e-mail.  Let me know what other questions you
have!

Magma should behave as advertised.  I'm using it with no issues.  Let me know
if you find any issues and I'll get them fixed!

Regards,
  Chris


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



More information about the Squeak-dev mailing list