Feature Toggles in Java
Do you know the concept of feature toogles (or feature flags)?
I will not write a lot about it, but if you want to know more, read Feature Toggles.
In short, you can put some feature, code in production, but you can hide, delay it from the user.
If you think in a big IF, you got the idea. But how to do it properly?
If you want a local solution, you can learn how to use Togglz - A Java implementation of the Feature Flags.
I’m helping a developer to create a demo with this tool. You can check the PR opened here.
You define your features using an enum like this:
and you can test if the feature is active in your code:
Why this is good? That was my first question when I watched a presentation about this pattern.
These features can be enabled/disabled in real-time, or scheduled, in this scenario using Togglz, you can use the Admin Console, or the actuator to change it.
Imagine you have a feature to start in July 1st. You can release your code in prod before, check everything, and schedule to be available in this release date. Can you see benefits now?
If you don’t want a local library, you can use AWS AppConfig to manage your flags. You already have the concept here, just switch ( not an inception case please =D ) the libraries.
Don’t forget to remove the code (if’s) and features that doesn’t make more sense in your application!
Happy coding!