Smalltalk Best Practice Patterns Volume 1: Coding - Free
Smalltalk Best Practice Patterns Volume 1: Coding - Free
Smalltalk Best Practice Patterns Volume 1: Coding - Free
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
StateSure, how you specify behavior is most important in coding <strong>Smalltalk</strong> objects, but you still won’tget anywhere without state. Before you start a computation, something has to record what theproblem is. While you are computing you often need to store intermediate results. And when youfinish a computation, you have to remember the answer.Most state-related decisions have more to do with modeling and less with coding, so the patternshere don’t tell anything like the whole story. However, the tactical decisions you make aboutrepresentation will have an important impact on how well your communicates with others.This section talks about two kinds of state, instance variables and temporary variables. Of the two,temporary variables are covered much more thoroughly, because they are completely an artifact ofcoding, living only as long as a method is computing. Instance variables also have an important roleto play in coding, however, so their role in coding, and even some of their role in modeling, iscovered here.<strong>Coding</strong> <strong>Patterns</strong> page 59 of 147 9/30/2006