We branch code to develop new features without affecting production, and to minimize merge conflicts. Branching by abstraction avoids directly porting code between branches. Instead, feature flags or configuration options are used to selectively enable features, allowing previous implementations and tests to be preserved when features are added or removed. This approach keeps code cleaner and makes it easier to promote changes or revert them without risk of losing features.
1 of 13
Download to read offline
More Related Content
Branching by abstraction
1. why we need to branch
write new code without affecting old code
build and test new code in staging
environments without affecting production
2. why we branch by abstraction
to avoid porting code from one branch to the
other
to minimise merge operations performed by
our SCM
3. we branch by abstraction
not to be changing our code
but
to configure our code
4. when do we branch by abstraction
we have to develop a new feature
we have to change an existing feature
5. how do we branch by abstraction
feature flagged
feature flagged
NOT feature
flagged
8. what happens when we release
remove feature flag from command
remove feature flag from model
remove feature flag from the command test
remove feature flag from the model test
run the tests again to see that everything is
still working
...and we LOST the previous
implementation!
9. we branch by abstraction
not to be changing our code
but not
to configure our code
12. Solution ProsCons
Pros:
focusing only on the needed
behavior without touching the
previous class
rely on previous implementations
and tests
cleaner tests against cleaner
classes
only one place for feature flags
easy to revert/promote code
from/to release
no feature loss
Cons:
not a silver bullet for everything
for sure
any suggestion?
13. we branch by abstraction
not to be changing our code
but
to configure our code