Implementing Trampoline Objects in Perl

Steven Lembark (Workhorse Computing)
Perl
Location: E145
Average rating: ****.
(4.00, 6 ratings)
Slides:   external link

Trampoline Objects are a flyweight pattern used to manage objects that are expensive or problematic to initialize at program startup.
They can be used to delay connecting via server handles, which avoids overloading servers and saves the need to start every known server to test a subset of code.

The usual choices for dealing with this situation include re-initializeing the objects with every use, querying the variables for is-usable, or keeping a separate is-initialized flag. All of these approaches are expensive in either overhead or coding convolutions required to pre-validate each object each time it is used.

Trampolines offer a better approach with an object that is inexpensive to instantiate and can mutate into the object necessary when the first method is called on it. Once used the object is a member of the expensive class and requires no further wrapping or special handling.

This talk describes the Object::Trampoline module with examples of using it as either a standard trampoline or factory object.

Photo of Steven Lembark

Steven Lembark

Workhorse Computing

Steven Lembark is a consultant working with ETL and automation code.

Sponsors

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at (707) 827-7065 or scordesse@oreilly.com.

Contact Us

View a complete list of OSCON contacts