Absolutely.
On Nov 9, 2007 8:28 PM, Todd Blanchard tblanchard@mac.com wrote:
You should make an *object model* with your root object being a true custom domain object like a "InvestmentPortfolio", not a dumb collection. This InvestmentPortfolio may then reference several MagmaCollections which can serve as your "buckets"..
Mkay - what if I want to add more buckets later? Will that "just work"?
On Nov 9, 2007, at 5:24 PM, Chris Muller wrote:
Hi Todd, MagmaSets are only for very specific purposes, and only after they absolutely pay for themselves 10X over a regular MagmaCollection. You are not there yet. MagmaSets are twice as slow as a standard MagmaCollection when adding because they have to check #includes: before every add.
The MyDatabaseSession subclass seems like an attempt to make the session itself act as a "bucket" to stuff data into and then retrieve out of later. This is not necessary and probably even not very workable with Magma.
You should make an *object model* with your root object being a true custom domain object like a "InvestmentPortfolio", not a dumb collection. This InvestmentPortfolio may then reference several MagmaCollections which can serve as your "buckets"..
Regards, Chris
On Nov 8, 2007 1:36 AM, Todd Blanchard tblanchard@mac.com wrote:
OK, I'm totally frustrated. I can't thing one in or out of this database.
I want the root to act like a dictionary - so I set it up like this:
| set | set := (MagmaSet equivalenceAttributes: (Array with: #key)). set addIndex: (MaSearchStringIndex attribute: #key). MagmaRepositoryController create: 'magma' root: set.
I start the server session on a port and leave it. In the client I subclass MagmaSession to add schema specific methods. One thing I add is this:
MyDatabaseSession>>at: aSymbol ifAbsentPut: aBlock
| collection assoc | collection := (self root where:[:ea | ea key = aSymbol]). collection isEmpty ifTrue: [self root add: (assoc := aSymbol->(aBlock
value))] ifFalse: [assoc := collection first]. ^assoc value.
This fails on a newly created database because MaCollectionReader isEmpty ends up calling sortIndex on a MaQueryTrunk which doesn't seem to understand it.
What gives?