New feature with config

New feature with config

Using config switch is a way to switch off or on a feature on a working software during runtime. We can use configuration or condition to achieve this. Config switch is also known as feature flag, feature toggle and conditional feature.

Why do we need config switch?

My first experience with config switch in sellanycar.com, when i had to deploy the feature related to the button on customer dashboard to upload their payment proof against their purchasing.

You can only use this switch config for certain reasons:

  • Control the release of a feature: getting your code merged, tested, and deployed into production and only delivering it to your users when you (or your product manager) want(s).
  • Speed up development by integrating incomplete features.
  • Allow releasing when a new feature is not yet ready.
  • Enable to derisk releases using gradual feature rollout.
  • Enable roll back when production issue found in feature

Example Code

isFeatureOn config can be setting in the database or part of .env file.

if (isFeatureOn) {
    // give access to something
} else {
    // prevent access to something
}

Turn it off

So let's assume, that you tested your feature intensively on your production environment and you didn't get any complaint from customer once you are satisfied you just remove the condition and deploy again. Switch feature cleanup is also required for clean code.

Conclusion

Stop making big tasks/tickets that take weeks to complete. Apply feature switch and deploy small things. Don't afraid to test them on production and switch off if there is any breaking change.

Faizan Khan

Senior PHP Developer | Symfony Expert | Microservices | NestJS | OpenAI | AWS | Docker | GIT

4 å¹´

Umair Mumtaz We need to clean up some config which doesn't require as per the best practises. :-D

要查看或添加评论,请登录

Faizan Khan的更多文章

  • 2 Simple Principles to Get Your Pull Request Approved and Merged Faster

    2 Simple Principles to Get Your Pull Request Approved and Merged Faster

    Note: These 2 principles as per my understanding and experience, it might not be applied to all open source projects…

    1 条评论
  • SOLID DESIGN PRINCIPLES IN PHP

    SOLID DESIGN PRINCIPLES IN PHP

    This post is to provide an easy to understand idea about the implementation of one of the most “talked about”…

社区洞察

其他会员也浏览了