Skip to main content Accessibility help
×
Hostname: page-component-8448b6f56d-cfpbc Total loading time: 0 Render date: 2024-04-25T00:56:59.519Z Has data issue: false hasContentIssue false

26 - WHERE DO OBJECTS COME FROM? FROM VARIABLES AND METHODS

Smalltalk Report, May, 1994

Published online by Cambridge University Press:  04 August 2010

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

Summary

More thinking about design/modeling. This one covers my pet peeve-people who use fixed-sized collections with meaningful indexes (e.g. “1 is red, 2 is blue, 3 is green”). In my patterns book, I covered this in some detail when I talk about your program talking to you. Darn it, if red, green, and blue go together, then make an object for them, figure out what it should be called, and figure out what it should do. If you don't create the easy objects, how will you ever be able to see to create the hard ones?

Let's see if I can get through this third column on how objects are born without blushing. So far we've seen two patterns: “Objects from States” and “Objects from Collections.” This time we'll look at two more sources of objects: “Objects from Variables” and “Objects from Methods.” All four patterns have one thing in common—they create objects that would be difficult or impossible to invent before you have a running program.

These patterns are part of the reason I am suspicious of any methodology that smacks of the sequence, “design, then program.” The objects that shape the way I think about my programs almost always come out of the program, not out of my preconceptions. Thinking “the design phase is over, now I just have to push on and finish the implementation” is a sure way to miss these valuable objects and end up with a poorly structured, inflexible application to boot.

Type
Chapter
Information
Kent Beck's Guide to Better Smalltalk
A Sorted Collection
, pp. 239 - 244
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.

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.

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.

Available formats
×