Conventionally, people use feature branches which are merged into the master trunk for release. This is hard to revert and leads to merge hell.

A better (according to ECE453) philosophy is to use a single trunk with feature flags.

  • This easy accommodates A-B testing, dark launching, canary releases, feature specific rollbacks The idea here is that we can easily toggle on and off a feature at any point in time.

Note

DevOps is almost impossible without trunk based development.

Here, old and new feature code are compiled into the same build. We are able to toggle on an old version and single features are behind toggles, they are written in a more isolated, decoupled manner.

More Advantages

  • Reconciling rapid release and longterm feature development
  • Flexible feature roll-out
  • Enabling fast context switches
  • Features are designed to be toggle-able

Cons

  • Toggle debt (its like commenting out code but keeping old code compiled and “live)
  • Combinatorial feature testing
    • The features can change while a system is running, which features should we test
    • Test and gradually roll out any feature combination that will be used in production
  • Can’t remove toggles until we are sure the new feature is working. This delay could mean that we forget exactly what we need to remove or don’t want to do it.

Types

  1. Developer utility
  2. Release
  3. Long term