DEV Community

Professor Himtee
Professor Himtee

Posted on

Feature toggle (change system behaviour during runtime)

Have you ever thought how the apps locks and unlocks the premium features and how and why only some users get the latest version of the apps? So, today we will see one of the technique called Feature toggle which enable programmers to achieve all these automated system behaviour without changing anything in code once deployed.

Let's started with term toggle, it is basically a condition which has the capability to enable or disable the logic which is inside that condition. And feature toggling is the technique of creating such toggles which helps in changing the behaviour of application dynamically.

It can be categorized into four different parts : Release, Experiment, Ops and Premission.
There are two important factors which determines the behaviour of toggles and they are dynamism and longevity. Dynamism is how frequently that toggle will comes into execution part of the code, and later is the lifetime of that toggle.
Alt Text

Now we will try to understand the use-case of four toggles mentioned above.

1. Release toggle : This toggle generally used when you have incomplete code or untested code which is a part of the release cycle. The lifetime of this toggle is short because the fix or change(if any) will be a part of next release cycle which is due soon.

2. Experiment toggle : This toggle is used to test the new feature on any application. You have heard multiple times that some feature is available for specific users only. This is done just for realtime validation of the feature and can be achieved using experiment toggle.

3. Ops toggle : This comes into play when you have to disable any specific functionalties of the platform. They are very much similar to circuit beakers.

4. Permission toggle : You have seen the use-case of this toggle in every paid applications. This enables application to hide the premium feature for non-premium and make available for premium users.

To read more about feature toggle refer this.

Oldest comments (0)