My first Magma experience (Now including GOODS)

David Shaffer cdshaffer at acm.org
Mon Apr 4 07:08:22 UTC 2005


Daniel Salama wrote:

>
> I agree with you 100% on this, but this simple test is only a small
> part of a large application. The model is much more complex. However,
> to a certain degree, several features of the application will do a
> very similar task. Something as simple as providing the application
> user with a way to list all customer records within 5 miles of a given
> zip code. In my amateur mind, this implies that I will pretty much
> have to iterate through a large collection of objects to select the
> ones that match the criteria.

Why not choose a storage or indexing structure which makes these lookups
fast?  There are several "spacially" oriented indexing mechanisms like
RST trees.  I'm sure that there is one out there that meets your needs. 
You add the burden of maintaining an index but given that with something
like GOODS you have paid almost nothing for persistence, it isn't a big
deal to add a little code to keep an index up to date.  I find very few
such indexes in my applications in general.  Another common case is the
need to index an object on the values of several of its i-vars so it can
be displayed in a sorted table.  This is trivial with something like
TSTree's but, again, you have to maintain the index in your code:

someIndexedField: value
    self someIndexedFieldIndex removeKey: someIndexedField. "remove old
entry"
    someIndexedField := value.
    self someIndexedFieldIndex at: value put: self "store new entry"



David




More information about the Squeak-dev mailing list