Squeak programming question

Andres Valloud sqrmax at cvtci.com.ar
Mon Mar 22 14:21:39 UTC 1999


Hi.

> The only thing that occurs to me is something like:
> 
> ^((OrderedCollection new) add: myDictionary add: mySet)
> 
> and then disassemble the thing on the receiving side.  I'm
> not really crazy about this though.

Yep... it depends.

1. Rephrase as aCollectionClass with: firstObject with: secondObject. It's a bit
more elegant, and if you use Array then it's somewhat more efficient... but
still you're left with the parsing afterwards. Sometimes it's needed, though.

2. If the object answering that message is an algorithm, then model it as an
object of its own. For instance, think about matrix reduction. You give aMatrix
to aMatrixReducer, and then perform:

aMatrixReducer run.

By now it knows the reduced matrix, now it feels comfortable to make questions
like:

aMatrixReducer reducedMatrix
aMatrixReducer independentColumns
aMatrixReducer millisecondsToRun "it already knows, it's an algorithm"

Andres.





More information about the Squeak-dev mailing list