I just stumbled across the concept of feature flagging, and a popular open source Java lib for this called Togglz, which quotes a Martin Fowler blog post:
The basic idea is to have a configuration file that defines a bunch of toggles for various features you have pending. The running application then uses these toggles in order to decide whether or not to show the new feature.
But to me, this really sounds like authorization: Is the user authorized to view this content?
For example, Should the user be able to see the FizzBuzz menu, or not?
In Togglz I might implement this check like so:
if(MyFeatures.ShowFizzBuzz.isActive()) {
// Show the FizzBuzz menu.
}
In, say, Apache Shiro, I could do the exact same thing:
ShowFizzBuzzPermission showFizzBuzz = new ShowFizzBuzzPermission();
if(currentUser.isPermitted(showFizzBuzz) {
// Show the FizzBuzz menu.
}
Again, feature flagging just feels like its the same exact problem as role- or permission-checking.
I'm sure I'm wrong, but I don't see how. So I ask: How is feature flagging different than authorization and role/permission checking, and what types of concrete use cases exemplify this difference? In other words: When should I use authorization/role/permission checking, and when should I use feature flags?