Closed reinhardt closed 1 year ago
Thanks for the suggestions. I see even more potential to improve this code. I'll check how much effort we can spend.
Generally speaking, I think it is a good practice to not introduce feature flags and if all over the place to handle custom behaviors because it often leads to code which is harder to maintain.
What would you say is a better alternative?
Generally speaking, I think it is a good practice to not introduce feature flags and if all over the place to handle custom behaviors because it often leads to code which is harder to maintain.
What would you say is a better alternative?
See my suggestion in https://github.com/euphorie/Euphorie/pull/596#discussion_r1221339895
You code looks like
class A:
flag_active = False
def __call__(self):
if self.flag_active:
return "something"
else:
return "something else"
class B(A):
flag_active = True
My suggestion is to make it look like to this:
class A:
def __call__(self):
return "something"
class B(A):
def __call__(self):
return "something else"
That's especially helpful in this case because of the cyclomatic complexity of the method.
Oh, that's what you mean. Now I get it, thanks. I do see the benefits. On the other hand, if I have a flag with a speaking name like use_solution_descriptions
, it is potentially clearer what the intention is.
I'll merge this now and clean up in a new pull request.
except for France and Italy when measures in place are active
syslabcom/scrum#1245