by newaccount74 · 4y ago · 0 comments
def func1():
...
A()
B()
C()
...
def func2():
...
A()
B()
C()
...
Which is then refactored to def func1():
...
ABC()
...
def func2():
...
ABC()
...
def ABC():
A()
B()
C()
Which is sensible, but then other functions show up: def func3()
...
A()
C()
...
And you refactor to: def func1():
...
ABC(True)
...
def func2():
...
ABC(True)
...
def func3()
...
ABC(False)
...
def ABC(doB):
A()
if (doB):
B()
C()
I'll leave the final example to your imagination, since I've already used so much screen space.I'm currently in the process of undoing a lot of such refactorings in my codebase because it has become unmanageable.
I really think repetitive code is much easier to work with than overabstracted code.