[squeak-dev] design issue of someone trying to think like a smalltaker

Chris Muller asqueaker at gmail.com
Wed Oct 17 15:10:29 UTC 2012


Hi Joseph, my sense is that you are asking about how to _separate_
Account instances you created in the past from newer versions of
Accounts based on having made further progress in your development.

You mentioned that allInstances do: [] gives you old instances from
debugging, which you don't want.

My solution to this partitioning -- e.g.,to  keep only the instances
of Accounts which belong together separate from old instances of
Accounts which I'm no longer interested in because they're defunct
because I was just debuggin them -- is to use the "World" pattern.

It's actually a published pattern TMK but, in this case, the World
could be called "AccountsBook" or something like that.  It would have
(at least) two inst-vars called "accounts" and "transactions".

Now, you have a place to put methods ("tools" or otherwise) to operate
on just the related groups of Accounts and Transactions.

This is what I do for all my models now -- the World object ends up
being the root object of the database and the root of the entire
model.

 - Chris


On Tue, Oct 16, 2012 at 12:53 PM, Joseph J Alotta
<joseph.alotta at gmail.com> wrote:
> Greetings,
>
> I have several Accounts and the accounts have Transactions.
>
> My plan was to instantiate a Transaction and to populate it from a file, and then have each of the Transactions
> attach themselves to an Account.
>
> This is a sort of bottom up design.
>
> The problem is that I have a bunch of Accounts and Transactions running around the system and no tools for working with them.
>
> I can do Accounts allInstances do: [].   But then I also get old instances (from debugging).
>
> Is this a good way of doing things?  Do I need to have some Collection somewhere, so I can go and find each item
> when I need it?  Like a common control mechanism?  And if so, what would it look like?
>
> Do you think I should create a list of accounts and then each Account will have a list of Transactions?  The old top down approach?
>
> Sincerely,
>
> Joe.
>
>
>
>
>
>
>
>


More information about the Squeak-dev mailing list