Feature Toggle: A hands-on guide to start using it

Feature toggles are one of the most relevant mechanisms used to modify features in real-time without changing code. Developers can test different changes on a specific group of users before making them available to everyone, being essential in mitigating risks.

This article will provide an overview of how you can benefit from using a feature toggle and how you can implement it into your development or production environments.

What is a feature toggle?

It is a strategy that allows us to enable and disable resources and functionalities in our system in real-time without any changes on the published codebase.

Feature toggles allow defining whether or not such a feature should be connected in real-time, allowing Software Engineering Teams to release a new version of the application more continuously and connect resources and functionalities only when desired.

Why is it so important?

We can make changes in real-time (or close to it) on websites, but with the mobile apps, there is an intermediary — the Apple Store and Play Store need to revise them before the official release.

90% of apps are usually reviewed in 48 hours, which means an average delay of 2 days for new updates before the customers receive them.

In addition, review times may be further delayed for special reasons such as an important holiday, weekends, and the app also may be rejected by the store if the revisor considers that a guideline was not respected.

When a feature or a modification of a feature is released, we should always consider its impact, whether positive or negative. What would happen if an update caused a bug? Without a feature toggle, we would need 2 days to release a new update and a few days for all users to receive this new version.

Using feature toggle makes it possible to turn off the feature or modification responsible for causing this bad scenario in real-time.

How to implement a feature toggle?

These two different options can be considered:


Firebase Remote Config

Remote Config is a framework of Firebase that allows us to dynamically control and change the app's behavior without republishing.

The picture below exemplifies it — we have a ModuleA with two features, A and B, where featureA is enabled and featureB is disabled.

It's already included on the core of Firebase accounts without any additional costs, as you can confirm here.


Split

Split is a service that combines feature flags and data to provide control of the application dynamically. It reduces the engineering cycle time, mitigates release risk, and creates an impact-driven culture.

As you can see in the picture below, we used the same example applied on Firebase Remote Config.

It will have additional costs that need to be negotiated with a split team, as you can check here.


Follow this link to have more information on how you can implement a Feature Toggle.

Conclusion

Feature toggles are a powerful addition to an agile development arsenal. They complement continuous deployment and give teams more control of their codebase, deployment, and the end-user experience. Teams can test features safely and securely while releasing them with a targeted approach.

Paulo Leite
Mobile Developer