Configuration Files As Extensions
A ConfigFile may be enough to customize the module for reasonable needs. It may also specify modules by name to be created and employed in a framework.
# the config.pl file defines @listeners to contain a list of class names # that should receive notices from an EventListener broadcaster, # referenced by $broadcaster. require 'config.pl'; foreach my $listener (@listeners) { require $listener; my $list_inst = $listener->new; $broadcaster->add_listener($list_inst); }See Event listener for the broadcaster/listener idiom. This avoids building the names of listener modules into the application. An independent author could write a plugin to this application: she would need only have the user modify //config.pl// to include mention of the plugin. Of course, modification of //config.pl// could be automated. The install program for the plugin would need to ask the user where the //config.pl// is, and use the ConfigFile idiom to update it.
Read more about this topic: Extensibility Pattern
Famous quotes containing the words files and/or extensions:
“But some who this blithe mood present,
As on in lightsome files they fare,
Shall die experienced ere three days be spent
Perish, enlightened by the vollied glare;
Or shame survive, and, like to adamant,
Thy after shock, Manassas, share.”
—Herman Melville (18191891)
“The psychological umbilical cord is more difficult to cut than the real one. We experience our children as extensions of ourselves, and we feel as though their behavior is an expression of something within us...instead of an expression of something in them. We see in our children our own reflection, and when we dont like what we see, we feel angry at the reflection.”
—Elaine Heffner (20th century)