I have a question regarding possible implementation alternatives to the one I'm currently using.
The requirement: to be able to turn on/off particular features of an application at run time.
Right now, we have a class that we call "applicationProperties" with a bunch of different properties (isFeatureXEnabled, isFeatureYEnabled, etc, etc) which the application code (and UI code in some cases) is using to determine whether or not to turn on/off a particular feature. What's nice is that we can export the "applicationProperties" file as an MBean and change/update its values at run time through the JMX console.
My question:
At the moment, our application code is riddled with awful if/else statements specifying whether a particular feature should be enabled.
E.G.:
if(isFeatureXEnabled()){
.. do something...
}
other parts of the app:
if(isFeatureYEnabled()){
.. do something..
}
etc...
Has anyone else run into a requirement such as this (ability to turn on/off features at run-time) without polluting and littering their code base with if/else statements?
Thanks in advance for any input!


Reply With Quote