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.

Class: SuperFindingClientsuperclass: InstructionClientinstance variables: foundSuperFindingClient class>>isSuperSentBy: aMethod^self new isSuperSentBy: aMethodSuperFindingClient>>isSuperSentBy: aMethod| stream |found := false.stream := InstructionStream on: aMethod.[stream atEnd] whileFalse: [stream interpretNextInstructionFor: self].^foundSuperFindingClient>>sendSuper: aSymbol numArgs: anIntegerfound := trueI sometimes get into trouble using Send Back when I get several levels of Delegation and SendBack going at once. When I start to get confused, I sit down a draw a diagram that shows all theobjects and all the protocols they expect of each other. I invariably find that I am misusing SendBack or Delegation in at least one case, and I can clarify the situation by removing the gratuitouspattern.You can use Cunningham diagrams [ref OOPSLA 86], OORam Message Scenario diagrams [refReenskaug], or Object Interaction diagrams [ref Jacobsen] for this kind of analysis.Give your messages Intention Revealing Selectors.<strong>Coding</strong> <strong>Patterns</strong> page 46 of 147 9/30/2006

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

Saved successfully!

Ooh no, something went wrong!