|Perl: the Markov chain saw|
OO Design question: configurationby spurperl (Priest)
|on May 19, 2007 at 15:54 UTC||Need Help??|
spurperl has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow monks,
I have a general OO design meditation...
In my application I have a very important configuration file that defines how the application acts in many ways. The application code is subdivided to many objects that don't interact much, but in most cases are there to encapsulate pieces of functionality. These objects are instantiated from the main flow and do their work.
Now, many of the objects need access to configuration data to do their work - sometimes it's quite a few configuration items for each object. The configuration data is encapsulated in an objects itself - the object reads the configuration data and provides access to it in an easy hash-like fashion.
I am wondering what is the best approach, design wise, to pass the configuration data into these objects. There are a few options:
Now, all this becomes even more complicated when there are more than one configuration files, each with a distinct set of data that is not combinable, and some objects need access to different configuration objects.
Please share your thoughts - I'm sure it's quite a common issue. Is there a "pattern" for it ?
Thanks in advance