功能切换与功能分支 [英] Feature Toggles vs Feature Branches

查看:25
本文介绍了功能切换与功能分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是功能切换"和功能分支",它们之间有什么区别?

What are "Feature Toggles" and "Feature Branches" and what's the difference between them?

有什么优点和缺点?为什么一个比另一个更好?

What are the pros and cons? Why is one better than the other?

我在 Google 上找到了一些关于此的文章,我倾向于功能切换"阵营,但我不相信功能切换"在所有情况下都是更好的选择.

I found some articles on Google regarding this, and I tend to be in the "Feature Toggles" camp, but I'm not convinced that "Feature Toggles" is the better choice in all the cases.

推荐答案

功能切换是在持续集成/持续交付 (CI/CD) 链(敏捷/看板项目方法)中使用的方法.基本上,您将新功能以禁用状态发送到生产环境,然后在管理控制台中打开该功能(如果您发现它已损坏,则将其关闭).

Feature toggles are methodology used in a Continuous Integration/Continuous Delivery (CI/CD) chain (Agile/Kanban project methodology). Basically, you send new features to production in a disabled state, then in an admin console turn the feature on (or off if you discover it's broken).

功能分支可以成为发布方法的一部分并集成到持续集成链中.您可以在功能分支中进行开发,将分支部署到 DEV/QA,获得认证,将功能分支合并到主干,然后将主干推送到 SIT/UAT/PROD 环境.

Feature branches can be part of a release methodology and integrated into a continuous integration chain. You can develop in a feature branch, deploy the branch to DEV/QA, get certification, merge the feature branch to trunk, then push the trunk to SIT/UAT/PROD environments.

这种方法有利有弊.功能切换需要非常严格的纪律,因为损坏/暗码正在投入生产.这对于初创公司和商店来说非常有用,因为管理层知道如何实现这一点并拥有系统自动化工具(Chef/Puppet/cfengine 等).谷歌、Facebook、LinkedIn、WordPress 都使用功能切换和系统自动化部署到生产环境中.

There are pros and cons associated with this approach. Feature toggling requires very strict discipline as broken/dark code is making it to production. This is great for startups and shops where management knows how to pull this off and has system automation tools in place (Chef/Puppet/cfengine, etc.) Google, Facebook, LinkedIn, WordPress all deploy to production environments using feature toggling and system automation.

正确切换功能需要一些先决条件:持续交付/部署、持续集成、自动化单元测试、自动化集成测试、自动化压力/性能测试、系统自动化.如果您没有这些,请考虑更简单的发布策略(例如功能分支.)

There are some prerequisite "techs" to do feature toggling properly: Continuous Delivery/Deployment, Continuous Integration, Automated Unit Testing, Automated Integration Testing, Automated Stress/Performance Testing, System Automation. If you don't have these in place, consider a simpler release strategy (e.g. feature branching.)

这篇关于功能切换与功能分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆