Enhance BaseToggle with additional methods.
Add the following:
- is_disabled: Returns not
is_enabled.
- is_toggled_on: Returns
is_enabled.
- is_toggled_off: Returns not
is_enabled.
This should make a variety of conditions more readable when ENABLE_ or DISABLE_ are in the toggle name.
Example 1: is_disabled
# BEFORE: slightly less readable
not SOME_FEATURE_TOGGLE.is_enabled()
# AFTER: more clear
SOME_FEATURE_TOGGLE.is_disabled()
Example 2: is_toggled_off
# BEFORE: brain twister
not DISABLE_SOME_FEATURE.is_enabled()
# AFTER: more clear
DISABLE_SOME_FEATURE.is_toggled_off()
Notes:
Questions:
Is this in fact simpler to understand? Are there better options?
- We've decided to move forward
Work required:
Enhance BaseToggle with additional methods.
Add the following:
is_enabled.is_enabled.is_enabled.This should make a variety of conditions more readable when
ENABLE_orDISABLE_are in the toggle name.Example 1:
is_disabledExample 2:
is_toggled_offNotes:
DISABLE_FEATUREtoggle, the toggle is off when the feature is on, so we use_toggle_in the method nameis_toggled_offto clearly refer to the toggle and not the feature.Questions:
Is this in fact simpler to understand? Are there better options?Work required: