in reply to Singleton method wrappers for config file properties: Bad idea?
Personally, I would write a class representing the configuration, give it the ability to load its properties from a file, and then give the server object an instance of this config object. This allows the normal subclassing etc. mechanisms, for example one could overload the methods to allow the config to be loaded from a database instead of a file. I don't really see the advantage of "singleton methods" here. If you want to avoid writing $server->config->ip_address, then you could give the server class some convenience methods, e.g. $server->ip_address just calls the aforementioned method.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Singleton method wrappers for config file properties: Bad idea?
by nysus (Parson) on Apr 01, 2017 at 12:02 UTC | |
by shmem (Chancellor) on Apr 01, 2017 at 13:40 UTC | |
by haukex (Archbishop) on Apr 01, 2017 at 12:13 UTC |