O'Reilly logo

Smalltalk Best Practice Patterns by Kent Beck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. State

Sure, how you specify behavior is most important in coding Smalltalk objects, but you still won’t get anywhere without state. Before you start a computation, something has to record what the problem is. While you are computing, you often need to store intermediate results. When you finish a computation, you have to remember the answer.

Most state-related decisions have more to do with modeling and less with coding, so the patterns here don’t tell anything like the whole story. However, the tactical decisions you make about representation will have an important impact on how well your code communicates with others.

This section talks about two kinds of state: instance variables and temporary variables. Of the two, temporary variables ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required