I am developing an application where part of the supported features may become optional in the future, so the user can enable/disable them. However I am not aware of an approach in handling such optional features in the code.
Is it just like putting checks to see if the feature is enabled by the user or not, before executing that part of the code,
if (isFeatureXEnabled)
{
//do something
}
else
{
//don't do it OR show some notification/dialog to the user that it is disabled
}
or (hopefully) there is a better approach/design pattern that can be used?
if
statements, the Decorator pattern, unchanged code and varying configuration data, inheritance and abstract factories, etc. We have to have more detailed information to answer that. – Kilian Foth Aug 25 '17 at 13:45