13.07.2015 Views

Smalltalk Best Practice Patterns Volume 1: Coding - Free

Smalltalk Best Practice Patterns Volume 1: Coding - Free

Smalltalk Best Practice Patterns Volume 1: Coding - Free

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Collection ProtocolThe uniform protocol of the collection classes are one of their greatest strengths. Client code iseffectively decoupled from decisions about how to store a collection by using a common set ofmessages.Many <strong>Smalltalk</strong> programmers take a long time to learn all the collection protocol. They begin witha couple of messages, like do: and add: and size, and then stick with them for a long time.I can remember being overwhelmed by <strong>Smalltalk</strong> when I started programming in it. There is a lot tolearn just to achieve basic competence. However, the collection protocol is one of the highestleverage pieces of the system. The better you can use it, the faster you can code and the faster youcan read other folks code.This section highlights the most important messages in the collection repertoire. It is by no meansexhaustive. I selected these messages to pattern because they are the ones I see most often missedor misused.After you master these messages, take a day or so to make a thorough study of which messages areavailable in which collection classes. In no time, you’ll be coding collections like a pro.<strong>Coding</strong> <strong>Patterns</strong> page 101 of 147 9/30/2006

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!