Getting started with Feature Flags
In code, a Feature Flag is nothing more than an if
statement. Let's assume you have a current implementation of the dialog to register new users:
function showRegisterDialog(){
// current implementation
}
Now, you want to create a new dialog using a Feature Flag and be able to switch on the new dialog at runtime:
function showRegisterDialog(){
var newRegisterDialog = false;
if( newRegisterDialog ){
return showNewRegisterDialog();
}else{
return showOldRegisterDialog();
}
}
function showNewRegisterDialog(){
// new implementation
}
function showOldRegisterDialog(){
// old implementation
}
To enable or disable the feature dynamically...