it is not so straightforward as sounds. You can and should do this only if this part of the code won't change differently for different cases, but who knows that it won't happen.
It is ok for some technical functions, but for business code, I would rather think twice.
There is no bad in duplicating code: fewer dependencies, more readable, and really not so hard to maintain as looks like.
From my perspective, a better approach is WET (Write Everything Twice).
it is not so straightforward as sounds. You can and should do this only if this part of the code won't change differently for different cases, but who knows that it won't happen.
It is ok for some technical functions, but for business code, I would rather think twice.
There is no bad in duplicating code: fewer dependencies, more readable, and really not so hard to maintain as looks like.
From my perspective, a better approach is WET (Write Everything Twice).
Yes. If they might diverge, then it's OK to make a copy and change that.