Feature Gating

NamyaLG
3 min readDec 24, 2022

--

What is Feature Gating

Feature gating is a software development practice in which specific features or functionality of a product or system are selectively enabled or disabled based on specific criteria or conditions

Consider a scenario where a new feature or an enhancement to a component is being developed. The Old Feature is the existing feature, while the Enhanced Feature has been developed recently.

Old and New Features

How can it be said for sure that the feature will be better/desired by the end users?

Metrics and data will be required to substantiate the same

In the above example, some metrics could be the number of page visits or number of button clicks, etc

Feature gating is like a SWITCH :

SWITCH ON → NEW FEATURE EXPOSED → TREATMENT GROUP

SWITCH OFF → OLD FEATURE EXPOSED → CONTROL GROUP

Percentages to treatment and control groups are varied, and

metrics are studied over a period of time

Generated by ChatGPT, not me ⬇

[Start]

In the context of feature engineering, a treatment group refers to a group of data points or observations that have received a specific treatment or intervention. This treatment may be a new feature that has been added to the data, a transformation applied to the data or any other type of manipulation of the data.

The treatment group is typically used in comparison to a control group, which is a group of data points or observations that have not received the same treatment. By comparing the results or outcomes between the treatment group and the control group, analysts can determine the effectiveness of the treatment and how it affects the outcome of interest.

For example, in a clinical trial, a treatment group may receive a new drug being tested, while a control group receives a placebo or the standard treatment. The results of the trial can then be compared to determine the effectiveness of the new drug. In a similar way, in the context of feature engineering, a treatment group may be used to test the effectiveness of a new feature or transformation applied to the data.

[End]

The above is an example of a user-facing feature, however, there can be other changes on the backend, infrastructure, etc which need to be validated before pushing changes into production.

How does Feature Gating look in code?

At a high level, feature gating can be implemented using if-else constructs.

if (SWITCH is ON) {
// SHOW THE NEW FEATURE
} else {
// SHOW THE OLD FEATURE
}

There can be various other usages and implementations.

What happens after the observation period ?

Once the observation period elapses, it is time to decide if the old feature is to stay or if the new feature is to be incorporated.

In case the Old Feature is to be retained, the SWITCH is OFF, and it resolves to false

if (false) {
// SHOW THE NEW FEATURE
} else {
// SHOW THE OLD FEATURE
}

In case the New Feature is to be retained, the SWITCH is ON, and it resolves to true

if (true) {
// SHOW THE NEW FEATURE
} else {
// SHOW THE OLD FEATURE
}

Both of the above cases lead to the creation of stale and dead code, which increases the technical debt.

Conclusion

In my opinion, the above process is very essential, yet very repetitive and monotonous. There is immense scope for automating the cleanup process.

--

--

NamyaLG
NamyaLG

Written by NamyaLG

Tech-enthusiast | Runner_for_life | #NoHumanIsLimited

No responses yet