DEV Community

Cover image for Feature Toggle
Israel-Lopes
Israel-Lopes

Posted on • Updated on

Feature Toggle

What is feature toggle?

Feature toggles is a design pattern where you place switches in the middle of your code, which will allow you to turn parts of your code on and off based on several things, one of which is functionality.

Feature flags

It's the switches, the toggles that you put inside your code.

What are the advantages?

The first advantage is that you can effectively work with trunk based. You won't have several branchs to merge and go up to production, so you'll have a single branch where everyone will commit, but the code that that go up will be off. That can go up to homologation, production, and staying that way off.

First advantage is that you don't suffer from merges, avoiding those problems (it worked and after the merge it doesn't work but).

  • Another thing is that if there is a problem in the code in production, you can turn off the piece of code.
  • For work environments that breathe ecommerce or similar, it is a great option. Because you can activate and deactivate advertisements, temporary promotions, etc., all with just one false flag.

And this is a great advantage of the concept.

Texto alternativo da imagem)

Top comments (0)