Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I implement feature toggle in Java from scratch?

I have a requirement to implement feature toggling in my current project. I have no idea how to implement it from scratch in Java.

I have read the theory behind the feature toggling at various articles related to this topic but I haven't yet seen the implementation tutorial or documentation that describe this in detail for a beginner.

like image 417
CodeHunter Avatar asked Jan 29 '18 15:01

CodeHunter


People also ask

What is feature toggle Java?

Feature Toggles are a very common agile development practices in the context of continuous deployment and delivery. The basic idea is to associate a toggle with each new feature you are working on. This allows you to enable or disable these features at application runtime, even for individual users.

How does feature toggling work?

Feature toggles, also known as feature flags, are components of software development that allow specific features of an application to be activated or deactivated at will. This allows developers to safely “toggle” new features on or off for testing.


2 Answers

I would recommend taking a look at some existing implementations to get ideas on how you want your system to behave and fits with your requirements. There is a small list at http://featureflags.io/java-feature-flags/, and poking around the web can probably find more.

In the end, you'll need to consider a few things:

  • Where are feature flags stored
  • How are feature flags applied/determined
  • What kind of deployments/rollouts do you need to support

Edit: From personal experience, Launch Darkly has a pretty cool approach where the clients are loaded with the rules engine for determining flag status, which makes it very fast & resilient to the hosted service going down.

like image 131
mrusinak Avatar answered Nov 30 '22 23:11

mrusinak


Have a look at the following projects:

  • Togglz
  • FF4J
  • Flip

And there's even more listed over at Feature Flags

like image 44
DJDaveMark Avatar answered Nov 30 '22 22:11

DJDaveMark