- Command-line flags, with the link to gflags.
- A/B flags
- Dynamic flags, which are more difficult
- More complex systems.
I’ve dealt with feature flags before, but never found an elegant way to scale those. Some of the issues that I came across were:
- Naming conventions. With more and more features added to the system, naming things becomes more and more difficult. Especially, when features cross over from one part of the system into another and need to be supported in different sub-modules. In a way, this reminds me of the old argument in the blogging community about using hierarchical categories vs. flat tags, with categories providing more order and tags providing multiple paths to the destination.
- Modularization issues. Feature flags are often need in the larger applications. The kind that provides a lot of features (duh!). But those large applications often consist of smaller parts, or modules. Deciding whether or not to implement the feature on the application level, and/or on the module level is difficult. Especially if those module features will need to be later grouped into application features.
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.
— Jeff Atwood (@codinghorror) August 31, 2014
In terms of implementation, I haven’t used any special tools or libraries. It was basically a set of configuration files, with feature variables defined per environment and altered during the deployment.
These days, something more robust than that is necessary for some of the projects at work. Gladly, there are plenty of available tools to choose from – no need to reinvent the wheel. For a good starting point, have a look at PHP Feature Flags website. The ones listed so far are:
- LaunchDarkly PHP Feature Flag SDK, to integrate your application with LaunchDarky service.
- Etsy Feature Flagging, not officially supported by Etsy anymore, but still popular and useful.
- Dzunke Feature Flags, which is a bundle for Symfony2. It’ll require Symfony-Configs for the actual features configuration.
- Qandidate Feature Flagging Library
- Rollout, a port of ruby’s rollout.
- PHP Feature Flags
- SoCloz Feature Flag Bundle
So, I guess, PHP is well covered when it comes to feature flags tools. The above cover cookie-based, IP-based, URL-based dynamic features, configuration-based features, and A/B features.
The point now is to actually utilize them in the project. After all, the lack of feature flags is one of the 5 toxic things for the scalability, as per this page:
- Object Relational Mappers (ORMs)
- Synchronous, Serial, Coupled or Locking Processes
- One Copy of Your Database
- Having No Metrics
- Lack of Feature Flags
I haven’t decided which library to use yet – will need to try them all and see which one is the most appropriate, but for now I don’t think I’ll dive as deep as cookie/URL/IP based features or A/B testing. Even the simplest configuration-based implementation will be helpful.