Do you know where your variables are? | |
PerlMonks |
Re: Build tree data structure from DB (flat) data; function golfby halley (Prior) |
on Aug 30, 2006 at 19:56 UTC ( [id://570463]=note: print w/replies, xml ) | Need Help?? |
Of the notable virtues of all good programmers, cleverness isn't one.
You're refactoring a common routine out so that it's more generalized and useful. You want to standardize to avoid introducing cut-n-paste bugs on the next opportunity to make a similar tree structure. Thus, it's more important to be clear and obvious than to be compact. If there's ever a specific reason to adopt a more compact and clever form of an algorithm, it should be to take advantage of some efficiency trick, turning a very slow O(n) into a very fast O(n). And explain what you're leveraging clearly. I see no particular efficiency worries here. --
In Section
Seekers of Perl Wisdom
|
|