Wednesday, December 21, 2022

Abstract Feature Branch (Redis Overrides & ConnectionPool)

Abstract Feature Branch (Feature Flags ruby/rails gem) has just had the biggest update in quite a while, in v1.3.0, v1.3.1, and v1.3.2. It had not been updated since 2014 and the GitHub repository had not been touched since 2018. And, yet believe it or not, when I tested the abstract_feature_branch Ruby gem with Ruby 3.1 and Rails 7, everything worked successfully out of the box!

This is an incredibly great testament to the excellent software architecture and design of the library, which made it resilient to all the changes that occurred in Ruby and Rails since 2014! If there is any reason to motivate software engineers to always strive for improving their software architecture/design skills and avoiding over-engineering by writing the simplest code possible, it would be this story of abstract_feature_branch working with the latest versions of Ruby and Rails after 8 years of no updates!

abstract_feature_branch is a Ruby gem that provides a variation on the Branch by Abstraction Pattern by Paul Hammant and the Feature Toggles Pattern by Martin Fowler.

It is a productivity and fault tolerance enhancing team practice.

It provides the ability to wrap blocks of code with an abstract feature branch name, and then specify in a configuration file which features to be switched on or off.

The goal is to build out upcoming features in the same source code repository branch  (i.e. continuous integration), regardless of whether all are completed by the next release date or not, thus increasing team productivity by preventing integration delays. Developers then disable in-progress features until they are ready to be switched on in production, yet enable them locally and in staging environments for in-progress testing.

This gives developers the added benefit of being able to switch a feature off after release should big problems arise for a high risk feature.

abstract_feature_branch additionally supports Domain Driven Design's pattern of Bounded Contexts by allowing developers to configure context-specific feature files if needed.

abstract_feature_branch is one of the simplest and most minimalistic "Feature Flags" ruby gems out there. It enables you to get started very quickly by simply leveraging YAML files without having to set up a data store if you do not need it (albeit, you also have the option to use Redis as a very fast in-memory data store).

The new releases mostly focused on supporting Redis Overrides (configuring general environment feature flags in Redis), compatibility with Redis ConnectionPool, and making Redis optional while loosening its required version number.

Change Log (noteworthy items only in 1.3.0-1.3.2):
  • Support (general-user) Redis Overrides (similar to Environment Variable Overrides)
  • Remove redis gem from required dependencies to allow using abstract_feature_branch without Redis
  • Support Redis ConnectionPool AbstractFeatureBranch::Configuration#feature_store
  • Officially support newer `redis` client gem version 5
  • Document support for Ruby 3.1, Rails 7 and Redis Server 7
  • Make configuration of Redis optional in generated Rails initializer
  • Add gem post install instructions, including how to run the Rails generators and install/use Redis

For more details, below is the Abstract Feature Branch README.

Cheers!


No comments: