Arrays v. otherCollections

Jimmie Houchin jhouchin at texoma.net
Mon Apr 28 18:20:08 UTC 2003


Ned Konz wrote:
> On Monday 28 April 2003 09:38 am, Jimmie Houchin wrote:
[snip]
>>Is there anything I should be aware of when creating
>>multi-dimensional Collections?
> 
> Yes. Multi-dimensional collections are often a sign of incomplete 
> design.
> 
> When your data gets this complex, you probably should have objects. 
> Why aren't Book, Chapter, Verse all object above?
> 
> If you have multi-dimensional collections of data of different kinds 
> you almost certainly should be using objects that themselves hold 
> collections.
> 
> The choice of which collection to use in those objects should depend 
> on access patterns.
> 
> In the case where you don't have to grow or shrink the collection, an 
> Array is probably fine.

Thanks for the advice.

Its pretty much what I suspected, but not being a professional or 
trained programmer I wanted some insight.

What you talk about above is much of what I thought about this weekend. 
I was thinking about how I need to go about moving my code from 
Workspace to the System Browser in classes, methods and objects.

Heretofore I've spent most of my time playing in a Workspace. Now I need 
to step forward and learn to give some permanence and structure to what 
I'm learning.

I was thinking that even if I used Arrays or Collections in the 
implementation of some of the objects I could provide a better interface 
for access which more intuitive for what the object is.

Then the implementation could change as I learn and refactor without 
causing future problems.

Once again, thanks.

Jimmie Houchin




More information about the Squeak-dev mailing list