in reply to Seek Help Refactoring
In the absence of more information, I like CountZero's answer, because it's clean and simple. But xdg's answer is a good one too, especially if there are cases where you might other subroutines (eg. gamma, delta, etc.) to call the new _internal_sub() subroutine.
I did want to point out that, when I encounter a situation like this, it often helps me to ask whether the two subroutines would be likely to evolve together? That is, if you were to make a change/improvement to alpha(), would you be making the same change/improvement to beta()? If so, then by all means use a flag (eg. set to "alpha" or "beta") so that you get more mileage from only having to make future changes to one subroutine rather than two.
|
|---|