ActionScript 3.0 Design Patterns

(Chris Devlin) #1

PART IV


IV.Behavioral Patterns


People’s behavior makes sense if you think about it in
terms of their goals, needs, and motives.
—Thomas Mann
Behavior which appears superficially correct but is
intrinsically corrupt always irritates those who see
below the surface.
—James Bryant Conant (An observation prompted by
forgetting to implement one of an interface’s methods.)
Insofar as international law is observed, it provides us
with stability and order and with a means of
predicting the behavior of those with whom we have
reciprocal legal obligations.
—J. William Fulbright (Explanation of why you probably
should avoid global variables when developing design
patterns.)
There was no difference between the behavior of a god
and the operations of pure chance.
—Thomas Pynchon (Description of an attempt to debug
a program.)

Behavioral patterns focus on the interaction between classes and objects, and the dis-


tribution of responsibility. These patterns describe both the patterns of classes and


objects and the communication between them. More than some of the other pat-


terns, you will find a division of labor for the Behavioral design patterns. Rather than


having a class doing all the work, tasks are more likely to be encapsulated and then


used by the class or between classes. As a result, you’ll find that these patterns tend


to consider algorithms and the assignment of responsibilities between objects.


Figure Part IV-1 illustrates this general idea.

Free download pdf