[Newbies] Proxy objects
Randal L. Schwartz
merlyn at stonehenge.com
Thu Jan 10 23:25:56 UTC 2008
>>>>> "cnantais" == cnantais <cnantais at gmail.com> writes:
cnantais> Can someone recommend a good read on how to use proxy objects in
cnantais> I'm trying to verify expectations about the messages that classes
cnantais> are receiving (as is done in rSpec, the Ruby BDD framework) and I
cnantais> think proxy objects may be the right pattern.
See the ObjectTracer class under "Kernel-Objects". Here's the class
An ObjectTracer can be wrapped around another object, and then give you a
chance to inspect it whenever it receives messages from the outside. For
(ObjectTracer on: Display) flash: (50 at 50 extent: 50 at 50)
will give control to a debugger just before the message flash is sent.
Obviously this facility can be embellished in many useful ways.
See also the even more perverse subclass, ObjectViewer, and its example.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
More information about the Beginners