Skip to main content Accessibility help
×
Hostname: page-component-8448b6f56d-sxzjt Total loading time: 0 Render date: 2024-04-19T04:57:32.701Z Has data issue: false hasContentIssue false

38 - USES OF VARIABLES: TEMPS

Smalltalk Report, September, 1995

Published online by Cambridge University Press:  04 August 2010

Kent Beck
Affiliation:
First Class Software, Inc.
Get access

Summary

This is clearly recycled material from the patterns book. Not much more to say here.

The topic of this and the next column is how to use instance and temporary variables. I came upon the information (some of it is patterns, some isn't yet) in the course of writing my forthcoming book of Smalltalk coding patterns. I looked at temporary variables first, and found patterns for four ways temps are used:

  1. Reuse the value of a side-effecting expression (like ∧SStream≫next∧T).

  2. Cache the value of an expensive expression.

  3. Explain the meaning of a complex expression.

  4. Collect the results of several expressions.

Success in hand, I went to look for a similar set of canonical uses of instance variables. No dice. I came up with a taxonomy of the uses of instance variables, but no patterns. Many of the uses are bound up in other patterns (like the instance variable that holds the current State object). Others are too vague to make good patterns. I'll present what I have so far, because I have found it useful even in its unpolished state.

Ward Cunningham and I had a good long talk about this. We decided that the reason I was having so much trouble was scope. In the first book I am looking for coding patterns, the tactics of successful Smalltalk. Choosing to use a temporary variable is a tactical decision.

Type
Chapter
Information
Kent Beck's Guide to Better Smalltalk
A Sorted Collection
, pp. 363 - 370
Publisher: Cambridge University Press
Print publication year: 1997

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • USES OF VARIABLES: TEMPS
  • Kent Beck, First Class Software, Inc.
  • Book: Kent Beck's Guide to Better Smalltalk
  • Online publication: 04 August 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511574979.041
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • USES OF VARIABLES: TEMPS
  • Kent Beck, First Class Software, Inc.
  • Book: Kent Beck's Guide to Better Smalltalk
  • Online publication: 04 August 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511574979.041
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • USES OF VARIABLES: TEMPS
  • Kent Beck, First Class Software, Inc.
  • Book: Kent Beck's Guide to Better Smalltalk
  • Online publication: 04 August 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511574979.041
Available formats
×