Chapter 5. Collections

The collection hierarchy is one of the great strengths of Smalltalk. Code that has to be tediously written over and over in other languages is a single word in Smalltalk. The result is more flexible, because the collections respond to much of the same protocol, so a linear list can be converted to a hash table by substituting “Set” for “OrderedCollection.”

The bad news is, the collection classes give you yet more stuff to learn so you can master Smalltalk. The good news is, no single piece of the protocol is complicated or hard to learn and the result is code that is simpler, faster, easier to maintain, and more flexible.

The very richness of the collection classes is their biggest drawback. Beginning programmers typically ...

Get Smalltalk Best Practice Patterns now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.