Closed manwar closed 5 years ago
Hey @manwar - i don't see this hash lookup being used elsewhere, so i'm not sure the reason to refactor it out and turn it into a global variable?
I agree it is not used anywhere else but in my humble opinion, it appears to be a CONSTANT and being CONSTANT, it should be declare at the top and reference where it is needed. It also de-couple sub map_type() from the CONSTANT. In future, if we ever add/remove anything from the list, you just update the list without ever touching the method itself.
I understand where you are coming from, it is not adding any improvement as such except making code little more readable, in my opinion.
Feel free to dump it, if it doesn't suit your idea :-)
If the hash lookup were used elsewhere I would agree with you that it's a constant, but it's only used in the one place as subroutine argument validation. There is nothing else currently using it.
IMO this actually reduces the readability of the code as a reader now has to reference a hash outside the subroutine, a couple of hundred lines above it. Given the subroutine in question is only a dozen lines long this feels like it isn't necessary.
I'm not adverse to changes that increase readability BTW, it's just that I don't feel this is one of those changes. I'm more concerned (at least I have become more concerned in recent years) about the history of a repo, namely bisects, blames, and lineage.
Hi @leejo
Please review the PR.
Many Thanks. Best Regards, Mohammad S Anwar