Smalltalk Scaffolding Patterns


By: J. Doble, K. Auer
Published in: PLoPD4
Pages: 199-219
Category: Smalltalk Idioms

Summary: Support for rapid development of prototypes using Smalltalk.

Url: http://www.rolemodelsoft.com/patterns/

Pattern: Extensible Attributes

Pages: 202-204

You're creating a class in a prototype. Other designers will add attributes to your class. Add a dictionary attribute to your class to store additional attributes against symbol keys. Provide an accessor for the dictionary. Use Artificial Accessors or Cached Extensibility

Pattern: Artificial Accessors

Pages: 204-206

You're using Extensible Attributes. To make accessing extended attributes easier, simulate the presence of accessors for extended attributes.

Pattern: Generated Accessors

Pages: 206-211

You're using Extensible Attributes. To make it easier for the attributes to be functional, write a code generator that generates standard missing accessors.

Pattern: Artificial Delegation

Pages: 211-213

You're creating a class in a prototype. Other designers will add attributes and operations to your class. Override the doesNotUnderstand: method of the delegator class to iterate through its attributes, looking for an attribute that supports the method selector that was not understood.

Pattern: Cached Extensibility

Pages: 213-216

You're using Artificial Accessors and/or Artificial Delegation. To identify the implicit behavior and make it part of the explicit behavior of the class, override the doesNotUnderstand: method, substituting code to generate explicit methods for the virtual methods invoked the first time the implicit message is sent.

Pattern: Selector Synthesis

Pages: 217-218

You're designing a class for a prototype. The class has state-based behavior. You expect additional states and events will be added to your class. Define states and events as symbols. For a given event/state pair, synthesize a method selector by concatenating the state and event symbols, then dispatch based on the resulting selector.