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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Role of <strong>Patterns</strong>ReadingThese patterns are used (sometimes not in precisely the form they appear here) in the constructionof the <strong>Smalltalk</strong> images sold by the vendors. Early in your <strong>Smalltalk</strong>ing career you will spend mostof your time reading code from the image. If you know what to expect, and you understand why thecode is the way it is, you will be able to read and understand more quickly and thoroughly.DevelopmentDuring development you will run into the same <strong>Smalltalk</strong> problems over and over. You can usethese patterns as a guide for how to solve these problems. “What should I name this instancevariable?” - flip to Role Suggesting Instance Variable Name and follow the solution. After you usea pattern a few times, you will internalize it, so you won’t have to go looking up the details eachtime. You can put the quick reference guide up so you don’t have to program with this whole bookon your lap.ReviewGroup reviews will go much more smoothly is everyone is knows and uses the patterns. You canuse the patterns to point out opportunities for improvement in code- “I see, you need a CompleteCreation Method for that class so these three methods can be simpler.”DocumentationYou can describe a system using patterns much more simply than if you use ordinary prose. A fewwords can take the place of many paragraphs, and do a better job, because so much is implied bythe patterns. If I say, “#x:y: and #r:theta: are the Complete Creation Methods for Point,” you knowexactly what I am talking about (or will when you read Complete Creation Method on page 26).Clean UpWhen I am consulting, I clean up code using the patterns as a way of both understanding what isthere better preparing for making quick changes once I understand what’s wrong and what’srequired. I generally start with the formatting patterns (page 122), then simplify methods withComposed Method 24 and Explaining Temporary Variable 81. Once I am done with this, it is easyto see where there is duplicated code, the sign of an opportunity for improvement.<strong>Coding</strong> <strong>Patterns</strong> page 20 of 147 9/30/2006

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

Saved successfully!

Ooh no, something went wrong!