Searching a technology for bugfix-toggle

I'm looking for a technology that will allow me to make changes to the code and toggle them via remote configuration. In fact, this is a normal feature toggle, except that I want to switch not new code, but changes to existing one. Here is why i need this. Talking about Android application. Play market works in such a way that when a new release is opened, users receive it not simultaneously, but over a course of several days. Some code that I include in the release should work exact same way for all users, otherwise something real bad will happen. So i can't just make a bugfix that will desynchronise users while part of them will recieve update and part of them won't. To avoid that situation, after every release I need to wait a few days until all users receive the update, and then enable bugfixes to the old core via feature toggle. I cannot come up with an elegant solution with the old one. I have two working implementations of this system.

One:

if (version >= 2.0) {
    new_method ();
} else {
    old_bad_method ();
}

'version' can be changed by configuration on the server.

Advantages of this implementation

  • intuitive

Minuses

  • conditions are accumulating

  • beginners tend to do this:

    if (checkSomething () && version> = 2.0 && foobarIsTrue) {

Second. Implementation with switching used class which I really want to get away from, because it is even worse:

class CoolClass {
    void old_bad_method () {}
}
 
class CoolClass_Fixed {
    void new_method_fix () {}
}

Advantages of this implementation

  • it just works

Minuses

  • duplicate classes accumulate, which are annoying
  • It's hard to understand what has changed between the two classes
  • beginners do not understand what is happening at all -cannot share multiple changes within one class

In the two implementations I've shown, the main problem is the accumulation of unused code. Another important drawback is the inability to separate multiple changes done in one release (in the case of the first implementation with a numbered version, this can be achieved by giving the features not a number, but a string name, but this will make even more chaos in understanding which code works and which does not) ...

I really hope that this big question is clear enough. I'd love to hear your ideas on how to implement a feature toggle for bugfixes.


Ответы (0 шт):